7 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
8 |
|
import static java.util.concurrent.TimeUnit.SECONDS; |
9 |
|
|
10 |
+ |
import java.util.Arrays; |
11 |
+ |
import java.util.Collections; |
12 |
|
import java.util.HashSet; |
13 |
+ |
import java.util.List; |
14 |
|
import java.util.concurrent.CancellationException; |
15 |
|
import java.util.concurrent.ExecutionException; |
16 |
|
import java.util.concurrent.ForkJoinPool; |
874 |
|
protected void realCompute() { |
875 |
|
AsyncFib f = new AsyncFib(8); |
876 |
|
FailingAsyncFib g = new FailingAsyncFib(9); |
877 |
+ |
ForkJoinTask[] tasks = { f, g }; |
878 |
+ |
Collections.shuffle(Arrays.asList(tasks)); |
879 |
|
try { |
880 |
< |
invokeAll(f, g); |
880 |
> |
invokeAll(tasks); |
881 |
|
shouldThrow(); |
882 |
|
} catch (FJException success) { |
883 |
|
checkCompletedAbnormally(g, success); |
912 |
|
AsyncFib f = new AsyncFib(8); |
913 |
|
FailingAsyncFib g = new FailingAsyncFib(9); |
914 |
|
AsyncFib h = new AsyncFib(7); |
915 |
+ |
ForkJoinTask[] tasks = { f, g, h }; |
916 |
+ |
Collections.shuffle(Arrays.asList(tasks)); |
917 |
|
try { |
918 |
< |
invokeAll(f, g, h); |
918 |
> |
invokeAll(tasks); |
919 |
|
shouldThrow(); |
920 |
|
} catch (FJException success) { |
921 |
|
checkCompletedAbnormally(g, success); |
933 |
|
FailingAsyncFib f = new FailingAsyncFib(8); |
934 |
|
AsyncFib g = new AsyncFib(9); |
935 |
|
AsyncFib h = new AsyncFib(7); |
936 |
< |
HashSet set = new HashSet(); |
937 |
< |
set.add(f); |
938 |
< |
set.add(g); |
932 |
< |
set.add(h); |
936 |
> |
ForkJoinTask[] tasks = { f, g, h }; |
937 |
> |
List taskList = Arrays.asList(tasks); |
938 |
> |
Collections.shuffle(taskList); |
939 |
|
try { |
940 |
< |
invokeAll(set); |
940 |
> |
invokeAll(taskList); |
941 |
|
shouldThrow(); |
942 |
|
} catch (FJException success) { |
943 |
|
checkCompletedAbnormally(f, success); |
1544 |
|
protected void realCompute() { |
1545 |
|
AsyncFib f = new AsyncFib(8); |
1546 |
|
FailingAsyncFib g = new FailingAsyncFib(9); |
1547 |
+ |
ForkJoinTask[] tasks = { f, g }; |
1548 |
+ |
Collections.shuffle(Arrays.asList(tasks)); |
1549 |
|
try { |
1550 |
< |
invokeAll(f, g); |
1550 |
> |
invokeAll(tasks); |
1551 |
|
shouldThrow(); |
1552 |
|
} catch (FJException success) { |
1553 |
|
checkCompletedAbnormally(g, success); |
1582 |
|
AsyncFib f = new AsyncFib(8); |
1583 |
|
FailingAsyncFib g = new FailingAsyncFib(9); |
1584 |
|
AsyncFib h = new AsyncFib(7); |
1585 |
+ |
ForkJoinTask[] tasks = { f, g, h }; |
1586 |
+ |
Collections.shuffle(Arrays.asList(tasks)); |
1587 |
|
try { |
1588 |
< |
invokeAll(f, g, h); |
1588 |
> |
invokeAll(tasks); |
1589 |
|
shouldThrow(); |
1590 |
|
} catch (FJException success) { |
1591 |
|
checkCompletedAbnormally(g, success); |
1603 |
|
FailingAsyncFib f = new FailingAsyncFib(8); |
1604 |
|
AsyncFib g = new AsyncFib(9); |
1605 |
|
AsyncFib h = new AsyncFib(7); |
1606 |
< |
HashSet set = new HashSet(); |
1607 |
< |
set.add(f); |
1608 |
< |
set.add(g); |
1599 |
< |
set.add(h); |
1606 |
> |
ForkJoinTask[] tasks = { f, g, h }; |
1607 |
> |
List taskList = Arrays.asList(tasks); |
1608 |
> |
Collections.shuffle(taskList); |
1609 |
|
try { |
1610 |
< |
invokeAll(set); |
1610 |
> |
invokeAll(taskList); |
1611 |
|
shouldThrow(); |
1612 |
|
} catch (FJException success) { |
1613 |
|
checkCompletedAbnormally(f, success); |