Skip to content

Commit

Permalink
[FIXED JENKINS-18895] MavenModuleSetBuild.getResult is expensive.
Browse files Browse the repository at this point in the history
Originally-Committed-As: d1d524863cbb2f1f443fc4bf7c25933b7a31b85d
  • Loading branch information
jglick committed Jul 29, 2013
1 parent 4157033 commit c2b5947
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/src/main/java/org/jvnet/hudson/test/RunLoadCounter.java
Expand Up @@ -50,12 +50,16 @@ public final class RunLoadCounter {

/**
* Prepares a new project to be measured.
* Call this <em>before</em> starting builds.
* Usually called before starting builds, but may also be called retroactively.
* @param project a project of any kind
* @throws IOException if preparations fail
*/
public static void prepare(AbstractProject<?,?> project) throws IOException {
project.getPublishersList().add(new MarkerAdder());
for (AbstractBuild<?,?> build : project._getRuns()) {
Marker.add(build);
build.save();
}
}

/**
Expand Down Expand Up @@ -97,6 +101,10 @@ private RunLoadCounter() {}
@Restricted(NoExternalUse.class)
public static final class Marker implements RunAction {

static void add(AbstractBuild<?,?> build) {
build.addAction(new Marker(build.getParent().getFullName(), build.getNumber()));
}

private final String project;
private final int build;

Expand Down Expand Up @@ -137,7 +145,7 @@ public static final class Marker implements RunAction {
public static final class MarkerAdder extends Notifier {

@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
build.addAction(new Marker(build.getParent().getFullName(), build.getNumber()));
Marker.add(build);
return true;
}

Expand Down

0 comments on commit c2b5947

Please sign in to comment.