ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ForkJoinPool8Test.java
(Generate patch)

Comparing jsr166/src/test/tck/ForkJoinPool8Test.java (file contents):
Revision 1.4 by dl, Thu Mar 21 19:06:54 2013 UTC vs.
Revision 1.9 by jsr166, Mon Jun 3 18:20:05 2013 UTC

# Line 59 | Line 59 | public class ForkJoinPool8Test extends J
59       * RecursiveAction and CountedCompleter, but with all actions
60       * executed in the common pool, generally implicitly via
61       * checkInvoke.
62 <     */
62 >     */
63  
64      private void checkInvoke(ForkJoinTask a) {
65          checkNotDone(a);
# Line 185 | Line 185 | public class ForkJoinPool8Test extends J
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;
# Line 223 | Line 223 | public class ForkJoinPool8Test extends J
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);
# Line 239 | Line 239 | public class ForkJoinPool8Test extends J
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);
# Line 253 | Line 253 | public class ForkJoinPool8Test extends J
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());
# Line 268 | Line 268 | public class ForkJoinPool8Test extends J
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  
# Line 346 | Line 346 | public class ForkJoinPool8Test extends J
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());
# Line 361 | Line 361 | public class ForkJoinPool8Test extends J
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));
# Line 376 | Line 376 | public class ForkJoinPool8Test extends J
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 {
# Line 392 | Line 392 | public class ForkJoinPool8Test extends J
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();
# Line 403 | Line 403 | public class ForkJoinPool8Test extends J
403      }
404  
405      /**
406     * helpQuiesce returns when tasks are complete.
407     * getQueuedTaskCount returns 0 when quiescent
408     */
409    public void testForkHelpQuiesce() {
410        RecursiveAction a = new CheckedRecursiveAction() {
411            public void realCompute() {
412                FibAction f = new FibAction(8);
413                assertSame(f, f.fork());
414                helpQuiesce();
415                assertEquals(21, f.result);
416                assertEquals(0, getQueuedTaskCount());
417                checkCompletedNormally(f);
418            }};
419        checkInvoke(a);
420    }
421
422    /**
406       * invoke task throws exception when task completes abnormally
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();
# Line 441 | Line 424 | public class ForkJoinPool8Test extends J
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);
# Line 455 | Line 438 | public class ForkJoinPool8Test extends J
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 {
# Line 473 | Line 456 | public class ForkJoinPool8Test extends J
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 {
# Line 493 | Line 476 | public class ForkJoinPool8Test extends J
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 {
# Line 513 | Line 496 | public class ForkJoinPool8Test extends J
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();
# Line 528 | Line 511 | public class ForkJoinPool8Test extends J
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 {
# Line 546 | Line 529 | public class ForkJoinPool8Test extends J
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());
# Line 565 | Line 548 | public class ForkJoinPool8Test extends J
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());
# Line 584 | Line 567 | public class ForkJoinPool8Test extends J
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());
# Line 603 | Line 586 | public class ForkJoinPool8Test extends J
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());
# Line 618 | Line 601 | public class ForkJoinPool8Test extends J
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());
# Line 629 | Line 612 | public class ForkJoinPool8Test extends J
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  
# Line 649 | Line 632 | public class ForkJoinPool8Test extends J
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  
# Line 672 | Line 655 | public class ForkJoinPool8Test extends J
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 {
# Line 690 | Line 673 | public class ForkJoinPool8Test extends J
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());
# Line 705 | Line 688 | public class ForkJoinPool8Test extends J
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);
# Line 722 | Line 705 | public class ForkJoinPool8Test extends J
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);
# Line 736 | Line 719 | public class ForkJoinPool8Test extends J
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);
# Line 759 | Line 742 | public class ForkJoinPool8Test extends J
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);
# Line 786 | Line 769 | public class ForkJoinPool8Test extends J
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;
# Line 803 | Line 786 | public class ForkJoinPool8Test extends J
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 {
# Line 821 | Line 804 | public class ForkJoinPool8Test extends J
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);
# Line 838 | Line 821 | public class ForkJoinPool8Test extends J
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);
# Line 857 | Line 840 | public class ForkJoinPool8Test extends J
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);
# Line 877 | Line 860 | public class ForkJoinPool8Test extends J
860  
861      // CountedCompleter versions
862  
863 <    public abstract class CheckedFJTask extends RecursiveAction {
881 <        protected abstract void realCompute() throws Throwable;
882 <
883 <        public final void compute() {
884 <            try {
885 <                realCompute();
886 <            } catch (Throwable t) {
887 <                threadUnexpectedException(t);
888 <            }
889 <        }
890 <    }
891 <
892 <    static abstract class CCF extends CountedCompleter {
863 >    abstract static class CCF extends CountedCompleter {
864          int number;
865          int rnumber;
866  
# Line 910 | Line 881 | public class ForkJoinPool8Test extends J
881              f.onCompletion(f);
882              if ((p = f.getCompleter()) != null)
883                  p.tryComplete();
884 <            else
885 <                f.quietlyComplete();
884 >            else
885 >                f.quietlyComplete();
886          }
887      }
888  
# Line 943 | Line 914 | public class ForkJoinPool8Test extends J
914      }
915  
916      // Version of CCF with forced failure in left completions
917 <    static abstract class FailingCCF extends CountedCompleter {
917 >    abstract static class FailingCCF extends CountedCompleter {
918          int number;
919          int rnumber;
920  
# Line 964 | Line 935 | public class ForkJoinPool8Test extends J
935              f.onCompletion(f);
936              if ((p = f.getCompleter()) != null)
937                  p.tryComplete();
938 <            else
939 <                f.quietlyComplete();
938 >            else
939 >                f.quietlyComplete();
940          }
941      }
942  
# Line 990 | Line 961 | public class ForkJoinPool8Test extends J
961              completeExceptionally(new FJException());
962          }
963      }
964 <    
964 >
965      /**
966       * invoke returns when task completes normally.
967       * isCompletedAbnormally and isCancelled return false for normally
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);
# Line 1013 | Line 984 | public class ForkJoinPool8Test extends J
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);
# Line 1027 | Line 998 | public class ForkJoinPool8Test extends J
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());
# Line 1042 | Line 1013 | public class ForkJoinPool8Test extends J
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());
# Line 1057 | Line 1028 | public class ForkJoinPool8Test extends J
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));
# Line 1072 | Line 1043 | public class ForkJoinPool8Test extends J
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 {
# Line 1088 | Line 1059 | public class ForkJoinPool8Test extends J
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();
# Line 1100 | Line 1071 | public class ForkJoinPool8Test extends J
1071      }
1072  
1073      /**
1103     * helpQuiesce returns when tasks are complete.
1104     * getQueuedTaskCount returns 0 when quiescent
1105     */
1106    public void testForkHelpQuiesceCC() {
1107       ForkJoinTask a =  new CheckedFJTask() {
1108            public void realCompute() {
1109                CCF f = new LCCF(null, 8);
1110                assertSame(f, f.fork());
1111                helpQuiesce();
1112                assertEquals(21, f.number);
1113                assertEquals(0, getQueuedTaskCount());
1114                checkCompletedNormally(f);
1115            }};
1116        checkInvoke(a);
1117    }
1118
1119    /**
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();
# Line 1137 | Line 1091 | public class ForkJoinPool8Test extends J
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);
# Line 1151 | Line 1105 | public class ForkJoinPool8Test extends J
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 {
# Line 1169 | Line 1123 | public class ForkJoinPool8Test extends J
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 {
# Line 1189 | Line 1143 | public class ForkJoinPool8Test extends J
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 {
# Line 1209 | Line 1163 | public class ForkJoinPool8Test extends J
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();
# Line 1224 | Line 1178 | public class ForkJoinPool8Test extends J
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 {
# Line 1242 | Line 1196 | public class ForkJoinPool8Test extends J
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());
# Line 1261 | Line 1215 | public class ForkJoinPool8Test extends J
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());
# Line 1280 | Line 1234 | public class ForkJoinPool8Test extends J
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());
# Line 1299 | Line 1253 | public class ForkJoinPool8Test extends J
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());
# Line 1314 | Line 1268 | public class ForkJoinPool8Test extends J
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());
# Line 1325 | Line 1279 | public class ForkJoinPool8Test extends J
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());
# Line 1336 | Line 1290 | public class ForkJoinPool8Test extends J
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              }};
# Line 1348 | Line 1302 | public class ForkJoinPool8Test extends J
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 {
# Line 1366 | Line 1320 | public class ForkJoinPool8Test extends J
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);
# Line 1383 | Line 1337 | public class ForkJoinPool8Test extends J
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);
# Line 1397 | Line 1351 | public class ForkJoinPool8Test extends J
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);
# Line 1417 | Line 1371 | public class ForkJoinPool8Test extends J
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);
# Line 1441 | Line 1395 | public class ForkJoinPool8Test extends J
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;
# Line 1458 | Line 1412 | public class ForkJoinPool8Test extends J
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 {
# Line 1476 | Line 1430 | public class ForkJoinPool8Test extends J
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);
# Line 1493 | Line 1447 | public class ForkJoinPool8Test extends J
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);
# Line 1512 | Line 1466 | public class ForkJoinPool8Test extends J
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines