776 |
|
} |
777 |
|
|
778 |
|
/** |
779 |
+ |
* completeExceptionally(null) surprisingly has the same effect as |
780 |
+ |
* completeExceptionally(new RuntimeException()) |
781 |
+ |
*/ |
782 |
+ |
public void testCompleteExceptionally_null() { |
783 |
+ |
RecursiveAction a = new CheckedRecursiveAction() { |
784 |
+ |
protected void realCompute() { |
785 |
+ |
AsyncFib f = new AsyncFib(8); |
786 |
+ |
f.completeExceptionally(null); |
787 |
+ |
try { |
788 |
+ |
f.invoke(); |
789 |
+ |
shouldThrow(); |
790 |
+ |
} catch (RuntimeException success) { |
791 |
+ |
assertSame(success.getClass(), RuntimeException.class); |
792 |
+ |
assertNull(success.getCause()); |
793 |
+ |
checkCompletedAbnormally(f, success); |
794 |
+ |
} |
795 |
+ |
}}; |
796 |
+ |
testInvokeOnPool(mainPool(), a); |
797 |
+ |
} |
798 |
+ |
|
799 |
+ |
/** |
800 |
|
* invokeAll(t1, t2) invokes all task arguments |
801 |
|
*/ |
802 |
|
public void testInvokeAll2() { |
897 |
|
AsyncFib f = new AsyncFib(8); |
898 |
|
FailingAsyncFib g = new FailingAsyncFib(9); |
899 |
|
ForkJoinTask[] tasks = { f, g }; |
900 |
< |
Collections.shuffle(Arrays.asList(tasks)); |
900 |
> |
shuffle(tasks); |
901 |
|
try { |
902 |
|
invokeAll(tasks); |
903 |
|
shouldThrow(); |
935 |
|
FailingAsyncFib g = new FailingAsyncFib(9); |
936 |
|
AsyncFib h = new AsyncFib(7); |
937 |
|
ForkJoinTask[] tasks = { f, g, h }; |
938 |
< |
Collections.shuffle(Arrays.asList(tasks)); |
938 |
> |
shuffle(tasks); |
939 |
|
try { |
940 |
|
invokeAll(tasks); |
941 |
|
shouldThrow(); |
956 |
|
AsyncFib g = new AsyncFib(9); |
957 |
|
AsyncFib h = new AsyncFib(7); |
958 |
|
ForkJoinTask[] tasks = { f, g, h }; |
959 |
< |
List taskList = Arrays.asList(tasks); |
939 |
< |
Collections.shuffle(taskList); |
959 |
> |
shuffle(tasks); |
960 |
|
try { |
961 |
< |
invokeAll(taskList); |
961 |
> |
invokeAll(Arrays.asList(tasks)); |
962 |
|
shouldThrow(); |
963 |
|
} catch (FJException success) { |
964 |
|
checkCompletedAbnormally(f, success); |
1566 |
|
AsyncFib f = new AsyncFib(8); |
1567 |
|
FailingAsyncFib g = new FailingAsyncFib(9); |
1568 |
|
ForkJoinTask[] tasks = { f, g }; |
1569 |
< |
Collections.shuffle(Arrays.asList(tasks)); |
1569 |
> |
shuffle(tasks); |
1570 |
|
try { |
1571 |
|
invokeAll(tasks); |
1572 |
|
shouldThrow(); |
1604 |
|
FailingAsyncFib g = new FailingAsyncFib(9); |
1605 |
|
AsyncFib h = new AsyncFib(7); |
1606 |
|
ForkJoinTask[] tasks = { f, g, h }; |
1607 |
< |
Collections.shuffle(Arrays.asList(tasks)); |
1607 |
> |
shuffle(tasks); |
1608 |
|
try { |
1609 |
|
invokeAll(tasks); |
1610 |
|
shouldThrow(); |
1625 |
|
AsyncFib g = new AsyncFib(9); |
1626 |
|
AsyncFib h = new AsyncFib(7); |
1627 |
|
ForkJoinTask[] tasks = { f, g, h }; |
1628 |
< |
List taskList = Arrays.asList(tasks); |
1609 |
< |
Collections.shuffle(taskList); |
1628 |
> |
shuffle(tasks); |
1629 |
|
try { |
1630 |
< |
invokeAll(taskList); |
1630 |
> |
invokeAll(Arrays.asList(tasks)); |
1631 |
|
shouldThrow(); |
1632 |
|
} catch (FJException success) { |
1633 |
|
checkCompletedAbnormally(f, success); |