185 |
|
final int number; |
186 |
|
int result; |
187 |
|
FibAction(int n) { number = n; } |
188 |
< |
public void realCompute() { |
188 |
> |
protected void realCompute() { |
189 |
|
int n = number; |
190 |
|
if (n <= 1) |
191 |
|
result = n; |
223 |
|
*/ |
224 |
|
public void testInvoke() { |
225 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
226 |
< |
public void realCompute() { |
226 |
> |
protected void realCompute() { |
227 |
|
FibAction f = new FibAction(8); |
228 |
|
assertNull(f.invoke()); |
229 |
|
assertEquals(21, f.result); |
239 |
|
*/ |
240 |
|
public void testQuietlyInvoke() { |
241 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
242 |
< |
public void realCompute() { |
242 |
> |
protected void realCompute() { |
243 |
|
FibAction f = new FibAction(8); |
244 |
|
f.quietlyInvoke(); |
245 |
|
assertEquals(21, f.result); |
253 |
|
*/ |
254 |
|
public void testForkJoin() { |
255 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
256 |
< |
public void realCompute() { |
256 |
> |
protected void realCompute() { |
257 |
|
FibAction f = new FibAction(8); |
258 |
|
assertSame(f, f.fork()); |
259 |
|
assertNull(f.join()); |
268 |
|
*/ |
269 |
|
public void testJoinIgnoresInterrupts() { |
270 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
271 |
< |
public void realCompute() { |
271 |
> |
protected void realCompute() { |
272 |
|
FibAction f = new FibAction(8); |
273 |
|
final Thread myself = Thread.currentThread(); |
274 |
|
|
346 |
|
*/ |
347 |
|
public void testForkGet() { |
348 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
349 |
< |
public void realCompute() throws Exception { |
349 |
> |
protected void realCompute() throws Exception { |
350 |
|
FibAction f = new FibAction(8); |
351 |
|
assertSame(f, f.fork()); |
352 |
|
assertNull(f.get()); |
361 |
|
*/ |
362 |
|
public void testForkTimedGet() { |
363 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
364 |
< |
public void realCompute() throws Exception { |
364 |
> |
protected void realCompute() throws Exception { |
365 |
|
FibAction f = new FibAction(8); |
366 |
|
assertSame(f, f.fork()); |
367 |
|
assertNull(f.get(5L, SECONDS)); |
376 |
|
*/ |
377 |
|
public void testForkTimedGetNPE() { |
378 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
379 |
< |
public void realCompute() throws Exception { |
379 |
> |
protected void realCompute() throws Exception { |
380 |
|
FibAction f = new FibAction(8); |
381 |
|
assertSame(f, f.fork()); |
382 |
|
try { |
392 |
|
*/ |
393 |
|
public void testForkQuietlyJoin() { |
394 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
395 |
< |
public void realCompute() { |
395 |
> |
protected void realCompute() { |
396 |
|
FibAction f = new FibAction(8); |
397 |
|
assertSame(f, f.fork()); |
398 |
|
f.quietlyJoin(); |
407 |
|
*/ |
408 |
|
public void testAbnormalInvoke() { |
409 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
410 |
< |
public void realCompute() { |
410 |
> |
protected void realCompute() { |
411 |
|
FailingFibAction f = new FailingFibAction(8); |
412 |
|
try { |
413 |
|
f.invoke(); |
424 |
|
*/ |
425 |
|
public void testAbnormalQuietlyInvoke() { |
426 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
427 |
< |
public void realCompute() { |
427 |
> |
protected void realCompute() { |
428 |
|
FailingFibAction f = new FailingFibAction(8); |
429 |
|
f.quietlyInvoke(); |
430 |
|
assertTrue(f.getException() instanceof FJException); |
438 |
|
*/ |
439 |
|
public void testAbnormalForkJoin() { |
440 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
441 |
< |
public void realCompute() { |
441 |
> |
protected void realCompute() { |
442 |
|
FailingFibAction f = new FailingFibAction(8); |
443 |
|
assertSame(f, f.fork()); |
444 |
|
try { |
456 |
|
*/ |
457 |
|
public void testAbnormalForkGet() { |
458 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
459 |
< |
public void realCompute() throws Exception { |
459 |
> |
protected void realCompute() throws Exception { |
460 |
|
FailingFibAction f = new FailingFibAction(8); |
461 |
|
assertSame(f, f.fork()); |
462 |
|
try { |
476 |
|
*/ |
477 |
|
public void testAbnormalForkTimedGet() { |
478 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
479 |
< |
public void realCompute() throws Exception { |
479 |
> |
protected void realCompute() throws Exception { |
480 |
|
FailingFibAction f = new FailingFibAction(8); |
481 |
|
assertSame(f, f.fork()); |
482 |
|
try { |
496 |
|
*/ |
497 |
|
public void testAbnormalForkQuietlyJoin() { |
498 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
499 |
< |
public void realCompute() { |
499 |
> |
protected void realCompute() { |
500 |
|
FailingFibAction f = new FailingFibAction(8); |
501 |
|
assertSame(f, f.fork()); |
502 |
|
f.quietlyJoin(); |
511 |
|
*/ |
512 |
|
public void testCancelledInvoke() { |
513 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
514 |
< |
public void realCompute() { |
514 |
> |
protected void realCompute() { |
515 |
|
FibAction f = new FibAction(8); |
516 |
|
assertTrue(f.cancel(true)); |
517 |
|
try { |
529 |
|
*/ |
530 |
|
public void testCancelledForkJoin() { |
531 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
532 |
< |
public void realCompute() { |
532 |
> |
protected void realCompute() { |
533 |
|
FibAction f = new FibAction(8); |
534 |
|
assertTrue(f.cancel(true)); |
535 |
|
assertSame(f, f.fork()); |
548 |
|
*/ |
549 |
|
public void testCancelledForkGet() { |
550 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
551 |
< |
public void realCompute() throws Exception { |
551 |
> |
protected void realCompute() throws Exception { |
552 |
|
FibAction f = new FibAction(8); |
553 |
|
assertTrue(f.cancel(true)); |
554 |
|
assertSame(f, f.fork()); |
567 |
|
*/ |
568 |
|
public void testCancelledForkTimedGet() { |
569 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
570 |
< |
public void realCompute() throws Exception { |
570 |
> |
protected void realCompute() throws Exception { |
571 |
|
FibAction f = new FibAction(8); |
572 |
|
assertTrue(f.cancel(true)); |
573 |
|
assertSame(f, f.fork()); |
586 |
|
*/ |
587 |
|
public void testCancelledForkQuietlyJoin() { |
588 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
589 |
< |
public void realCompute() { |
589 |
> |
protected void realCompute() { |
590 |
|
FibAction f = new FibAction(8); |
591 |
|
assertTrue(f.cancel(true)); |
592 |
|
assertSame(f, f.fork()); |
601 |
|
*/ |
602 |
|
public void testInForkJoinPool2() { |
603 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
604 |
< |
public void realCompute() { |
604 |
> |
protected void realCompute() { |
605 |
|
assertFalse(inForkJoinPool()); |
606 |
|
}}; |
607 |
|
assertNull(a.invoke()); |
612 |
|
*/ |
613 |
|
public void testReinitialize() { |
614 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
615 |
< |
public void realCompute() { |
615 |
> |
protected void realCompute() { |
616 |
|
FibAction f = new FibAction(8); |
617 |
|
checkNotDone(f); |
618 |
|
|
632 |
|
*/ |
633 |
|
public void testReinitializeAbnormal() { |
634 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
635 |
< |
public void realCompute() { |
635 |
> |
protected void realCompute() { |
636 |
|
FailingFibAction f = new FailingFibAction(8); |
637 |
|
checkNotDone(f); |
638 |
|
|
655 |
|
*/ |
656 |
|
public void testCompleteExceptionally() { |
657 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
658 |
< |
public void realCompute() { |
658 |
> |
protected void realCompute() { |
659 |
|
FibAction f = new FibAction(8); |
660 |
|
f.completeExceptionally(new FJException()); |
661 |
|
try { |
673 |
|
*/ |
674 |
|
public void testComplete() { |
675 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
676 |
< |
public void realCompute() { |
676 |
> |
protected void realCompute() { |
677 |
|
FibAction f = new FibAction(8); |
678 |
|
f.complete(null); |
679 |
|
assertNull(f.invoke()); |
688 |
|
*/ |
689 |
|
public void testInvokeAll2() { |
690 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
691 |
< |
public void realCompute() { |
691 |
> |
protected void realCompute() { |
692 |
|
FibAction f = new FibAction(8); |
693 |
|
FibAction g = new FibAction(9); |
694 |
|
invokeAll(f, g); |
705 |
|
*/ |
706 |
|
public void testInvokeAll1() { |
707 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
708 |
< |
public void realCompute() { |
708 |
> |
protected void realCompute() { |
709 |
|
FibAction f = new FibAction(8); |
710 |
|
invokeAll(f); |
711 |
|
checkCompletedNormally(f); |
719 |
|
*/ |
720 |
|
public void testInvokeAll3() { |
721 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
722 |
< |
public void realCompute() { |
722 |
> |
protected void realCompute() { |
723 |
|
FibAction f = new FibAction(8); |
724 |
|
FibAction g = new FibAction(9); |
725 |
|
FibAction h = new FibAction(7); |
742 |
|
*/ |
743 |
|
public void testInvokeAllCollection() { |
744 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
745 |
< |
public void realCompute() { |
745 |
> |
protected void realCompute() { |
746 |
|
FibAction f = new FibAction(8); |
747 |
|
FibAction g = new FibAction(9); |
748 |
|
FibAction h = new FibAction(7); |
769 |
|
*/ |
770 |
|
public void testInvokeAllNPE() { |
771 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
772 |
< |
public void realCompute() { |
772 |
> |
protected void realCompute() { |
773 |
|
FibAction f = new FibAction(8); |
774 |
|
FibAction g = new FibAction(9); |
775 |
|
FibAction h = null; |
786 |
|
*/ |
787 |
|
public void testAbnormalInvokeAll2() { |
788 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
789 |
< |
public void realCompute() { |
789 |
> |
protected void realCompute() { |
790 |
|
FibAction f = new FibAction(8); |
791 |
|
FailingFibAction g = new FailingFibAction(9); |
792 |
|
try { |
804 |
|
*/ |
805 |
|
public void testAbnormalInvokeAll1() { |
806 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
807 |
< |
public void realCompute() { |
807 |
> |
protected void realCompute() { |
808 |
|
FailingFibAction g = new FailingFibAction(9); |
809 |
|
try { |
810 |
|
invokeAll(g); |
821 |
|
*/ |
822 |
|
public void testAbnormalInvokeAll3() { |
823 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
824 |
< |
public void realCompute() { |
824 |
> |
protected void realCompute() { |
825 |
|
FibAction f = new FibAction(8); |
826 |
|
FailingFibAction g = new FailingFibAction(9); |
827 |
|
FibAction h = new FibAction(7); |
840 |
|
*/ |
841 |
|
public void testAbnormalInvokeAllCollection() { |
842 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
843 |
< |
public void realCompute() { |
843 |
> |
protected void realCompute() { |
844 |
|
FailingFibAction f = new FailingFibAction(8); |
845 |
|
FibAction g = new FibAction(9); |
846 |
|
FibAction h = new FibAction(7); |
860 |
|
|
861 |
|
// CountedCompleter versions |
862 |
|
|
863 |
– |
public abstract class CheckedFJTask extends RecursiveAction { |
864 |
– |
protected abstract void realCompute() throws Throwable; |
865 |
– |
|
866 |
– |
public final void compute() { |
867 |
– |
try { |
868 |
– |
realCompute(); |
869 |
– |
} catch (Throwable t) { |
870 |
– |
threadUnexpectedException(t); |
871 |
– |
} |
872 |
– |
} |
873 |
– |
} |
874 |
– |
|
863 |
|
abstract static class CCF extends CountedCompleter { |
864 |
|
int number; |
865 |
|
int rnumber; |
968 |
|
* completed tasks; getRawResult returns null. |
969 |
|
*/ |
970 |
|
public void testInvokeCC() { |
971 |
< |
ForkJoinTask a = new CheckedFJTask() { |
972 |
< |
public void realCompute() { |
971 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
972 |
> |
protected void realCompute() { |
973 |
|
CCF f = new LCCF(null, 8); |
974 |
|
assertNull(f.invoke()); |
975 |
|
assertEquals(21, f.number); |
984 |
|
* completed tasks |
985 |
|
*/ |
986 |
|
public void testQuietlyInvokeCC() { |
987 |
< |
ForkJoinTask a = new CheckedFJTask() { |
988 |
< |
public void realCompute() { |
987 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
988 |
> |
protected void realCompute() { |
989 |
|
CCF f = new LCCF(null, 8); |
990 |
|
f.quietlyInvoke(); |
991 |
|
assertEquals(21, f.number); |
998 |
|
* join of a forked task returns when task completes |
999 |
|
*/ |
1000 |
|
public void testForkJoinCC() { |
1001 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1002 |
< |
public void realCompute() { |
1001 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1002 |
> |
protected void realCompute() { |
1003 |
|
CCF f = new LCCF(null, 8); |
1004 |
|
assertSame(f, f.fork()); |
1005 |
|
assertNull(f.join()); |
1013 |
|
* get of a forked task returns when task completes |
1014 |
|
*/ |
1015 |
|
public void testForkGetCC() { |
1016 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1017 |
< |
public void realCompute() throws Exception { |
1016 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1017 |
> |
protected void realCompute() throws Exception { |
1018 |
|
CCF f = new LCCF(null, 8); |
1019 |
|
assertSame(f, f.fork()); |
1020 |
|
assertNull(f.get()); |
1028 |
|
* timed get of a forked task returns when task completes |
1029 |
|
*/ |
1030 |
|
public void testForkTimedGetCC() { |
1031 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1032 |
< |
public void realCompute() throws Exception { |
1031 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1032 |
> |
protected void realCompute() throws Exception { |
1033 |
|
CCF f = new LCCF(null, 8); |
1034 |
|
assertSame(f, f.fork()); |
1035 |
|
assertNull(f.get(LONG_DELAY_MS, MILLISECONDS)); |
1043 |
|
* timed get with null time unit throws NPE |
1044 |
|
*/ |
1045 |
|
public void testForkTimedGetNPECC() { |
1046 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1047 |
< |
public void realCompute() throws Exception { |
1046 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1047 |
> |
protected void realCompute() throws Exception { |
1048 |
|
CCF f = new LCCF(null, 8); |
1049 |
|
assertSame(f, f.fork()); |
1050 |
|
try { |
1059 |
|
* quietlyJoin of a forked task returns when task completes |
1060 |
|
*/ |
1061 |
|
public void testForkQuietlyJoinCC() { |
1062 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1063 |
< |
public void realCompute() { |
1062 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1063 |
> |
protected void realCompute() { |
1064 |
|
CCF f = new LCCF(null, 8); |
1065 |
|
assertSame(f, f.fork()); |
1066 |
|
f.quietlyJoin(); |
1074 |
|
* invoke task throws exception when task completes abnormally |
1075 |
|
*/ |
1076 |
|
public void testAbnormalInvokeCC() { |
1077 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1078 |
< |
public void realCompute() { |
1077 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1078 |
> |
protected void realCompute() { |
1079 |
|
FailingCCF f = new LFCCF(null, 8); |
1080 |
|
try { |
1081 |
|
f.invoke(); |
1091 |
|
* quietlyInvoke task returns when task completes abnormally |
1092 |
|
*/ |
1093 |
|
public void testAbnormalQuietlyInvokeCC() { |
1094 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1095 |
< |
public void realCompute() { |
1094 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1095 |
> |
protected void realCompute() { |
1096 |
|
FailingCCF f = new LFCCF(null, 8); |
1097 |
|
f.quietlyInvoke(); |
1098 |
|
assertTrue(f.getException() instanceof FJException); |
1105 |
|
* join of a forked task throws exception when task completes abnormally |
1106 |
|
*/ |
1107 |
|
public void testAbnormalForkJoinCC() { |
1108 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1109 |
< |
public void realCompute() { |
1108 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1109 |
> |
protected void realCompute() { |
1110 |
|
FailingCCF f = new LFCCF(null, 8); |
1111 |
|
assertSame(f, f.fork()); |
1112 |
|
try { |
1123 |
|
* get of a forked task throws exception when task completes abnormally |
1124 |
|
*/ |
1125 |
|
public void testAbnormalForkGetCC() { |
1126 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1127 |
< |
public void realCompute() throws Exception { |
1126 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1127 |
> |
protected void realCompute() throws Exception { |
1128 |
|
FailingCCF f = new LFCCF(null, 8); |
1129 |
|
assertSame(f, f.fork()); |
1130 |
|
try { |
1143 |
|
* timed get of a forked task throws exception when task completes abnormally |
1144 |
|
*/ |
1145 |
|
public void testAbnormalForkTimedGetCC() { |
1146 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1147 |
< |
public void realCompute() throws Exception { |
1146 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1147 |
> |
protected void realCompute() throws Exception { |
1148 |
|
FailingCCF f = new LFCCF(null, 8); |
1149 |
|
assertSame(f, f.fork()); |
1150 |
|
try { |
1163 |
|
* quietlyJoin of a forked task returns when task completes abnormally |
1164 |
|
*/ |
1165 |
|
public void testAbnormalForkQuietlyJoinCC() { |
1166 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1167 |
< |
public void realCompute() { |
1166 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1167 |
> |
protected void realCompute() { |
1168 |
|
FailingCCF f = new LFCCF(null, 8); |
1169 |
|
assertSame(f, f.fork()); |
1170 |
|
f.quietlyJoin(); |
1178 |
|
* invoke task throws exception when task cancelled |
1179 |
|
*/ |
1180 |
|
public void testCancelledInvokeCC() { |
1181 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1182 |
< |
public void realCompute() { |
1181 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1182 |
> |
protected void realCompute() { |
1183 |
|
CCF f = new LCCF(null, 8); |
1184 |
|
assertTrue(f.cancel(true)); |
1185 |
|
try { |
1196 |
|
* join of a forked task throws exception when task cancelled |
1197 |
|
*/ |
1198 |
|
public void testCancelledForkJoinCC() { |
1199 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1200 |
< |
public void realCompute() { |
1199 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1200 |
> |
protected void realCompute() { |
1201 |
|
CCF f = new LCCF(null, 8); |
1202 |
|
assertTrue(f.cancel(true)); |
1203 |
|
assertSame(f, f.fork()); |
1215 |
|
* get of a forked task throws exception when task cancelled |
1216 |
|
*/ |
1217 |
|
public void testCancelledForkGetCC() { |
1218 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1219 |
< |
public void realCompute() throws Exception { |
1218 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1219 |
> |
protected void realCompute() throws Exception { |
1220 |
|
CCF f = new LCCF(null, 8); |
1221 |
|
assertTrue(f.cancel(true)); |
1222 |
|
assertSame(f, f.fork()); |
1234 |
|
* timed get of a forked task throws exception when task cancelled |
1235 |
|
*/ |
1236 |
|
public void testCancelledForkTimedGetCC() throws Exception { |
1237 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1238 |
< |
public void realCompute() throws Exception { |
1237 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1238 |
> |
protected void realCompute() throws Exception { |
1239 |
|
CCF f = new LCCF(null, 8); |
1240 |
|
assertTrue(f.cancel(true)); |
1241 |
|
assertSame(f, f.fork()); |
1253 |
|
* quietlyJoin of a forked task returns when task cancelled |
1254 |
|
*/ |
1255 |
|
public void testCancelledForkQuietlyJoinCC() { |
1256 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1257 |
< |
public void realCompute() { |
1256 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1257 |
> |
protected void realCompute() { |
1258 |
|
CCF f = new LCCF(null, 8); |
1259 |
|
assertTrue(f.cancel(true)); |
1260 |
|
assertSame(f, f.fork()); |
1268 |
|
* getPool of non-FJ task returns null |
1269 |
|
*/ |
1270 |
|
public void testGetPool2CC() { |
1271 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1272 |
< |
public void realCompute() { |
1271 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1272 |
> |
protected void realCompute() { |
1273 |
|
assertNull(getPool()); |
1274 |
|
}}; |
1275 |
|
assertNull(a.invoke()); |
1279 |
|
* inForkJoinPool of non-FJ task returns false |
1280 |
|
*/ |
1281 |
|
public void testInForkJoinPool2CC() { |
1282 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1283 |
< |
public void realCompute() { |
1282 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1283 |
> |
protected void realCompute() { |
1284 |
|
assertFalse(inForkJoinPool()); |
1285 |
|
}}; |
1286 |
|
assertNull(a.invoke()); |
1290 |
|
* setRawResult(null) succeeds |
1291 |
|
*/ |
1292 |
|
public void testSetRawResultCC() { |
1293 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1294 |
< |
public void realCompute() { |
1293 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1294 |
> |
protected void realCompute() { |
1295 |
|
setRawResult(null); |
1296 |
|
assertNull(getRawResult()); |
1297 |
|
}}; |
1302 |
|
* invoke task throws exception after invoking completeExceptionally |
1303 |
|
*/ |
1304 |
|
public void testCompleteExceptionally2CC() { |
1305 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1306 |
< |
public void realCompute() { |
1305 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1306 |
> |
protected void realCompute() { |
1307 |
|
CCF f = new LCCF(null, 8); |
1308 |
|
f.completeExceptionally(new FJException()); |
1309 |
|
try { |
1320 |
|
* invokeAll(t1, t2) invokes all task arguments |
1321 |
|
*/ |
1322 |
|
public void testInvokeAll2CC() { |
1323 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1324 |
< |
public void realCompute() { |
1323 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1324 |
> |
protected void realCompute() { |
1325 |
|
CCF f = new LCCF(null, 8); |
1326 |
|
CCF g = new LCCF(null, 9); |
1327 |
|
invokeAll(f, g); |
1337 |
|
* invokeAll(tasks) with 1 argument invokes task |
1338 |
|
*/ |
1339 |
|
public void testInvokeAll1CC() { |
1340 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1341 |
< |
public void realCompute() { |
1340 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1341 |
> |
protected void realCompute() { |
1342 |
|
CCF f = new LCCF(null, 8); |
1343 |
|
invokeAll(f); |
1344 |
|
checkCompletedNormally(f); |
1351 |
|
* invokeAll(tasks) with > 2 argument invokes tasks |
1352 |
|
*/ |
1353 |
|
public void testInvokeAll3CC() { |
1354 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1355 |
< |
public void realCompute() { |
1354 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1355 |
> |
protected void realCompute() { |
1356 |
|
CCF f = new LCCF(null, 8); |
1357 |
|
CCF g = new LCCF(null, 9); |
1358 |
|
CCF h = new LCCF(null, 7); |
1371 |
|
* invokeAll(collection) invokes all tasks in the collection |
1372 |
|
*/ |
1373 |
|
public void testInvokeAllCollectionCC() { |
1374 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1375 |
< |
public void realCompute() { |
1374 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1375 |
> |
protected void realCompute() { |
1376 |
|
CCF f = new LCCF(null, 8); |
1377 |
|
CCF g = new LCCF(null, 9); |
1378 |
|
CCF h = new LCCF(null, 7); |
1395 |
|
* invokeAll(tasks) with any null task throws NPE |
1396 |
|
*/ |
1397 |
|
public void testInvokeAllNPECC() { |
1398 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1399 |
< |
public void realCompute() { |
1398 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1399 |
> |
protected void realCompute() { |
1400 |
|
CCF f = new LCCF(null, 8); |
1401 |
|
CCF g = new LCCF(null, 9); |
1402 |
|
CCF h = null; |
1412 |
|
* invokeAll(t1, t2) throw exception if any task does |
1413 |
|
*/ |
1414 |
|
public void testAbnormalInvokeAll2CC() { |
1415 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1416 |
< |
public void realCompute() { |
1415 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1416 |
> |
protected void realCompute() { |
1417 |
|
CCF f = new LCCF(null, 8); |
1418 |
|
FailingCCF g = new LFCCF(null, 9); |
1419 |
|
try { |
1430 |
|
* invokeAll(tasks) with 1 argument throws exception if task does |
1431 |
|
*/ |
1432 |
|
public void testAbnormalInvokeAll1CC() { |
1433 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1434 |
< |
public void realCompute() { |
1433 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1434 |
> |
protected void realCompute() { |
1435 |
|
FailingCCF g = new LFCCF(null, 9); |
1436 |
|
try { |
1437 |
|
invokeAll(g); |
1447 |
|
* invokeAll(tasks) with > 2 argument throws exception if any task does |
1448 |
|
*/ |
1449 |
|
public void testAbnormalInvokeAll3CC() { |
1450 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1451 |
< |
public void realCompute() { |
1450 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1451 |
> |
protected void realCompute() { |
1452 |
|
CCF f = new LCCF(null, 8); |
1453 |
|
FailingCCF g = new LFCCF(null, 9); |
1454 |
|
CCF h = new LCCF(null, 7); |
1466 |
|
* invokeAll(collection) throws exception if any task does |
1467 |
|
*/ |
1468 |
|
public void testAbnormalInvokeAllCollectionCC() { |
1469 |
< |
ForkJoinTask a = new CheckedFJTask() { |
1470 |
< |
public void realCompute() { |
1469 |
> |
ForkJoinTask a = new CheckedRecursiveAction() { |
1470 |
> |
protected void realCompute() { |
1471 |
|
FailingCCF f = new LFCCF(null, 8); |
1472 |
|
CCF g = new LCCF(null, 9); |
1473 |
|
CCF h = new LCCF(null, 7); |