3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
|
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
< |
import java.util.concurrent.ExecutionException; |
6 |
> |
import java.util.HashSet; |
7 |
|
import java.util.concurrent.CancellationException; |
8 |
+ |
import java.util.concurrent.ExecutionException; |
9 |
|
import java.util.concurrent.ForkJoinPool; |
10 |
|
import java.util.concurrent.ForkJoinTask; |
10 |
– |
import java.util.concurrent.ForkJoinWorkerThread; |
11 |
|
import java.util.concurrent.RecursiveAction; |
12 |
– |
import java.util.concurrent.TimeUnit; |
12 |
|
import java.util.concurrent.TimeoutException; |
13 |
|
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; |
14 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
15 |
|
import static java.util.concurrent.TimeUnit.SECONDS; |
17 |
– |
import java.util.HashSet; |
16 |
|
import junit.framework.*; |
17 |
|
|
18 |
|
public class ForkJoinTaskTest extends JSR166TestCase { |
916 |
|
} |
917 |
|
|
918 |
|
/** |
919 |
< |
* invokeAll(collection) throws exception if any task does |
919 |
> |
* invokeAll(collection) throws exception if any task does |
920 |
|
*/ |
921 |
|
public void testAbnormalInvokeAllCollection() { |
922 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
1583 |
|
} |
1584 |
|
|
1585 |
|
/** |
1586 |
< |
* invokeAll(collection) throws exception if any task does |
1586 |
> |
* invokeAll(collection) throws exception if any task does |
1587 |
|
*/ |
1588 |
|
public void testAbnormalInvokeAllCollectionSingleton() { |
1589 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
1605 |
|
testInvokeOnPool(singletonPool(), a); |
1606 |
|
} |
1607 |
|
|
1608 |
+ |
/** |
1609 |
+ |
* ForkJoinTask.quietlyComplete returns when task completes |
1610 |
+ |
* normally without setting a value. The most recent value |
1611 |
+ |
* established by setRawResult(V) (or null by default) is returned |
1612 |
+ |
* from invoke. |
1613 |
+ |
*/ |
1614 |
+ |
public void testQuietlyComplete() { |
1615 |
+ |
RecursiveAction a = new CheckedRecursiveAction() { |
1616 |
+ |
protected void realCompute() { |
1617 |
+ |
AsyncFib f = new AsyncFib(8); |
1618 |
+ |
f.quietlyComplete(); |
1619 |
+ |
assertEquals(8, f.number); |
1620 |
+ |
checkCompletedNormally(f); |
1621 |
+ |
}}; |
1622 |
+ |
testInvokeOnPool(mainPool(), a); |
1623 |
+ |
} |
1624 |
+ |
|
1625 |
|
} |