Permalink
Browse files

optimized creating object fClassesFinisher

  • Loading branch information...
1 parent ec96d2b commit 40484fd5874a63f19dfd5ac1020393eb0e268769 @Tibor17 committed Oct 11, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/main/java/org/junit/experimental/ParallelComputer.java
View
6 src/main/java/org/junit/experimental/ParallelComputer.java
@@ -199,7 +199,7 @@ public void schedule(Runnable childStatement) {
}
public void finished() {
- fClassesFinisher.countDown();
+ if (fClassesFinisher != null) fClassesFinisher.countDown();
}
});
return runner;
@@ -218,7 +218,7 @@ public void schedule(Runnable childStatement) {
public void finished() {
if (isClassPool) { //wait until all test cases finished
- awaitClassesFinished();
+ if (fProvidedPools) awaitClassesFinished();
tryFinish(service);
} else { //wait until the test case finished
if (fProvidedPools) {
@@ -254,7 +254,7 @@ public Runner getSuite(RunnerBuilder builder, java.lang.Class<?>[] classes)
maxConcurrentClasses= Math.min(maxConcurrentClasses, countClasses);
fSinglePoolBalancer= new Semaphore(maxConcurrentClasses);
}
- fClassesFinisher= new CountDownLatch(countClasses);
+ fClassesFinisher= fProvidedPools ? new CountDownLatch(countClasses) : null;
if (fParallelClasses) parallelize((ParentRunner) suite, threadPoolClasses(), true);
}
return suite;

0 comments on commit 40484fd

Please sign in to comment.