3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
|
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
+ |
|
7 |
+ |
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
8 |
+ |
import static java.util.concurrent.TimeUnit.SECONDS; |
9 |
+ |
|
10 |
|
import java.util.HashSet; |
11 |
|
import java.util.concurrent.CancellationException; |
12 |
|
import java.util.concurrent.ExecutionException; |
15 |
|
import java.util.concurrent.RecursiveAction; |
16 |
|
import java.util.concurrent.TimeoutException; |
17 |
|
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; |
18 |
< |
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
19 |
< |
import static java.util.concurrent.TimeUnit.SECONDS; |
20 |
< |
import junit.framework.*; |
18 |
> |
|
19 |
> |
import junit.framework.Test; |
20 |
> |
import junit.framework.TestSuite; |
21 |
|
|
22 |
|
public class ForkJoinTaskTest extends JSR166TestCase { |
23 |
|
|
24 |
|
public static void main(String[] args) { |
25 |
< |
junit.textui.TestRunner.run(suite()); |
25 |
> |
main(suite(), args); |
26 |
|
} |
27 |
|
|
28 |
|
public static Test suite() { |
48 |
|
} |
49 |
|
|
50 |
|
private void testInvokeOnPool(ForkJoinPool pool, RecursiveAction a) { |
51 |
< |
try { |
51 |
> |
try (PoolCleaner cleaner = cleaner(pool)) { |
52 |
|
assertFalse(a.isDone()); |
53 |
|
assertFalse(a.isCompletedNormally()); |
54 |
|
assertFalse(a.isCompletedAbnormally()); |
64 |
|
assertFalse(a.isCancelled()); |
65 |
|
assertNull(a.getException()); |
66 |
|
assertNull(a.getRawResult()); |
63 |
– |
} finally { |
64 |
– |
joinPool(pool); |
67 |
|
} |
68 |
|
} |
69 |
|
|
216 |
|
AtomicIntegerFieldUpdater.newUpdater(BinaryAsyncAction.class, |
217 |
|
"controlState"); |
218 |
|
|
219 |
< |
private BinaryAsyncAction parent; |
219 |
> |
private volatile BinaryAsyncAction parent; |
220 |
|
|
221 |
< |
private BinaryAsyncAction sibling; |
221 |
> |
private volatile BinaryAsyncAction sibling; |
222 |
|
|
223 |
|
protected BinaryAsyncAction() { |
224 |
|
} |