8 |
|
import junit.framework.*; |
9 |
|
import java.util.concurrent.Callable; |
10 |
|
import java.util.concurrent.Executor; |
11 |
– |
import java.util.concurrent.ExecutorService; |
12 |
– |
import java.util.concurrent.Executors; |
11 |
|
import java.util.concurrent.CancellationException; |
14 |
– |
import java.util.concurrent.CountDownLatch; |
12 |
|
import java.util.concurrent.ExecutionException; |
16 |
– |
import java.util.concurrent.Future; |
13 |
|
import java.util.concurrent.CompletableFuture; |
14 |
|
import java.util.concurrent.CompletionException; |
15 |
|
import java.util.concurrent.CompletionStage; |
580 |
|
} |
581 |
|
} |
582 |
|
|
583 |
+ |
static final boolean defaultExecutorIsCommonPool |
584 |
+ |
= ForkJoinPool.getCommonPoolParallelism() > 1; |
585 |
+ |
|
586 |
|
/** |
587 |
|
* Permits the testing of parallel code for the 3 different |
588 |
|
* execution modes without copy/pasting all the test methods. |
664 |
|
|
665 |
|
ASYNC { |
666 |
|
public void checkExecutionMode() { |
667 |
< |
assertSame(ForkJoinPool.commonPool(), |
668 |
< |
ForkJoinTask.getPool()); |
667 |
> |
assertEquals(defaultExecutorIsCommonPool, |
668 |
> |
(ForkJoinPool.commonPool() == ForkJoinTask.getPool())); |
669 |
|
} |
670 |
|
public CompletableFuture<Void> runAsync(Runnable a) { |
671 |
|
return CompletableFuture.runAsync(a); |