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

Comparing jsr166/src/test/tck/CountedCompleterTest.java (file contents):
Revision 1.6 by jsr166, Mon Jun 3 16:46:12 2013 UTC vs.
Revision 1.7 by jsr166, Mon Jun 3 18:20:05 2013 UTC

# Line 32 | Line 32 | public class CountedCompleterTest extend
32      static final int mainPoolSize =
33          Math.max(2, Runtime.getRuntime().availableProcessors());
34  
35    /**
36     * Analog of CheckedRunnable for ForkJoinTasks
37     */
38    public abstract class CheckedFJTask extends RecursiveAction {
39        protected abstract void realCompute() throws Throwable;
40
41        public final void compute() {
42            try {
43                realCompute();
44            } catch (Throwable t) {
45                threadUnexpectedException(t);
46            }
47        }
48    }
49
35      private static ForkJoinPool mainPool() {
36          return new ForkJoinPool(mainPoolSize);
37      }
# Line 524 | Line 509 | public class CountedCompleterTest extend
509       * completed tasks; getRawResult returns null.
510       */
511      public void testInvoke() {
512 <        ForkJoinTask a = new CheckedFJTask() {
513 <            public void realCompute() {
512 >        ForkJoinTask a = new CheckedRecursiveAction() {
513 >            protected void realCompute() {
514                  CCF f = new LCCF(null, 8);
515                  assertNull(f.invoke());
516                  assertEquals(21, f.number);
# Line 540 | Line 525 | public class CountedCompleterTest extend
525       * completed tasks
526       */
527      public void testQuietlyInvoke() {
528 <        ForkJoinTask a = new CheckedFJTask() {
529 <            public void realCompute() {
528 >        ForkJoinTask a = new CheckedRecursiveAction() {
529 >            protected void realCompute() {
530                  CCF f = new LCCF(null, 8);
531                  f.quietlyInvoke();
532                  assertEquals(21, f.number);
# Line 554 | Line 539 | public class CountedCompleterTest extend
539       * join of a forked task returns when task completes
540       */
541      public void testForkJoin() {
542 <        ForkJoinTask a = new CheckedFJTask() {
543 <            public void realCompute() {
542 >        ForkJoinTask a = new CheckedRecursiveAction() {
543 >            protected void realCompute() {
544                  CCF f = new LCCF(null, 8);
545                  assertSame(f, f.fork());
546                  assertNull(f.join());
# Line 569 | Line 554 | public class CountedCompleterTest extend
554       * get of a forked task returns when task completes
555       */
556      public void testForkGet() {
557 <        ForkJoinTask a = new CheckedFJTask() {
558 <            public void realCompute() throws Exception {
557 >        ForkJoinTask a = new CheckedRecursiveAction() {
558 >            protected void realCompute() throws Exception {
559                  CCF f = new LCCF(null, 8);
560                  assertSame(f, f.fork());
561                  assertNull(f.get());
# Line 584 | Line 569 | public class CountedCompleterTest extend
569       * timed get of a forked task returns when task completes
570       */
571      public void testForkTimedGet() {
572 <        ForkJoinTask a = new CheckedFJTask() {
573 <            public void realCompute() throws Exception {
572 >        ForkJoinTask a = new CheckedRecursiveAction() {
573 >            protected void realCompute() throws Exception {
574                  CCF f = new LCCF(null, 8);
575                  assertSame(f, f.fork());
576                  assertNull(f.get(LONG_DELAY_MS, MILLISECONDS));
# Line 599 | Line 584 | public class CountedCompleterTest extend
584       * timed get with null time unit throws NPE
585       */
586      public void testForkTimedGetNPE() {
587 <        ForkJoinTask a = new CheckedFJTask() {
588 <            public void realCompute() throws Exception {
587 >        ForkJoinTask a = new CheckedRecursiveAction() {
588 >            protected void realCompute() throws Exception {
589                  CCF f = new LCCF(null, 8);
590                  assertSame(f, f.fork());
591                  try {
# Line 615 | Line 600 | public class CountedCompleterTest extend
600       * quietlyJoin of a forked task returns when task completes
601       */
602      public void testForkQuietlyJoin() {
603 <        ForkJoinTask a = new CheckedFJTask() {
604 <            public void realCompute() {
603 >        ForkJoinTask a = new CheckedRecursiveAction() {
604 >            protected void realCompute() {
605                  CCF f = new LCCF(null, 8);
606                  assertSame(f, f.fork());
607                  f.quietlyJoin();
# Line 631 | Line 616 | public class CountedCompleterTest extend
616       * getQueuedTaskCount returns 0 when quiescent
617       */
618      public void testForkHelpQuiesce() {
619 <        ForkJoinTask a = new CheckedFJTask() {
620 <            public void realCompute() {
619 >        ForkJoinTask a = new CheckedRecursiveAction() {
620 >            protected void realCompute() {
621                  CCF f = new LCCF(null, 8);
622                  assertSame(f, f.fork());
623                  helpQuiesce();
# Line 647 | Line 632 | public class CountedCompleterTest extend
632       * invoke task throws exception when task completes abnormally
633       */
634      public void testAbnormalInvoke() {
635 <        ForkJoinTask a = new CheckedFJTask() {
636 <            public void realCompute() {
635 >        ForkJoinTask a = new CheckedRecursiveAction() {
636 >            protected void realCompute() {
637                  FailingCCF f = new LFCCF(null, 8);
638                  try {
639                      f.invoke();
# Line 664 | Line 649 | public class CountedCompleterTest extend
649       * quietlyInvoke task returns when task completes abnormally
650       */
651      public void testAbnormalQuietlyInvoke() {
652 <        ForkJoinTask a = new CheckedFJTask() {
653 <            public void realCompute() {
652 >        ForkJoinTask a = new CheckedRecursiveAction() {
653 >            protected void realCompute() {
654                  FailingCCF f = new LFCCF(null, 8);
655                  f.quietlyInvoke();
656                  assertTrue(f.getException() instanceof FJException);
# Line 678 | Line 663 | public class CountedCompleterTest extend
663       * join of a forked task throws exception when task completes abnormally
664       */
665      public void testAbnormalForkJoin() {
666 <        ForkJoinTask a = new CheckedFJTask() {
667 <            public void realCompute() {
666 >        ForkJoinTask a = new CheckedRecursiveAction() {
667 >            protected void realCompute() {
668                  FailingCCF f = new LFCCF(null, 8);
669                  assertSame(f, f.fork());
670                  try {
# Line 696 | Line 681 | public class CountedCompleterTest extend
681       * get of a forked task throws exception when task completes abnormally
682       */
683      public void testAbnormalForkGet() {
684 <        ForkJoinTask a = new CheckedFJTask() {
685 <            public void realCompute() throws Exception {
684 >        ForkJoinTask a = new CheckedRecursiveAction() {
685 >            protected void realCompute() throws Exception {
686                  FailingCCF f = new LFCCF(null, 8);
687                  assertSame(f, f.fork());
688                  try {
# Line 716 | Line 701 | public class CountedCompleterTest extend
701       * timed get of a forked task throws exception when task completes abnormally
702       */
703      public void testAbnormalForkTimedGet() {
704 <        ForkJoinTask a = new CheckedFJTask() {
705 <            public void realCompute() throws Exception {
704 >        ForkJoinTask a = new CheckedRecursiveAction() {
705 >            protected void realCompute() throws Exception {
706                  FailingCCF f = new LFCCF(null, 8);
707                  assertSame(f, f.fork());
708                  try {
# Line 736 | Line 721 | public class CountedCompleterTest extend
721       * quietlyJoin of a forked task returns when task completes abnormally
722       */
723      public void testAbnormalForkQuietlyJoin() {
724 <        ForkJoinTask a = new CheckedFJTask() {
725 <            public void realCompute() {
724 >        ForkJoinTask a = new CheckedRecursiveAction() {
725 >            protected void realCompute() {
726                  FailingCCF f = new LFCCF(null, 8);
727                  assertSame(f, f.fork());
728                  f.quietlyJoin();
# Line 751 | Line 736 | public class CountedCompleterTest extend
736       * invoke task throws exception when task cancelled
737       */
738      public void testCancelledInvoke() {
739 <        ForkJoinTask a = new CheckedFJTask() {
740 <            public void realCompute() {
739 >        ForkJoinTask a = new CheckedRecursiveAction() {
740 >            protected void realCompute() {
741                  CCF f = new LCCF(null, 8);
742                  assertTrue(f.cancel(true));
743                  try {
# Line 769 | Line 754 | public class CountedCompleterTest extend
754       * join of a forked task throws exception when task cancelled
755       */
756      public void testCancelledForkJoin() {
757 <        ForkJoinTask a = new CheckedFJTask() {
758 <            public void realCompute() {
757 >        ForkJoinTask a = new CheckedRecursiveAction() {
758 >            protected void realCompute() {
759                  CCF f = new LCCF(null, 8);
760                  assertTrue(f.cancel(true));
761                  assertSame(f, f.fork());
# Line 788 | Line 773 | public class CountedCompleterTest extend
773       * get of a forked task throws exception when task cancelled
774       */
775      public void testCancelledForkGet() {
776 <        ForkJoinTask a = new CheckedFJTask() {
777 <            public void realCompute() throws Exception {
776 >        ForkJoinTask a = new CheckedRecursiveAction() {
777 >            protected void realCompute() throws Exception {
778                  CCF f = new LCCF(null, 8);
779                  assertTrue(f.cancel(true));
780                  assertSame(f, f.fork());
# Line 807 | Line 792 | public class CountedCompleterTest extend
792       * timed get of a forked task throws exception when task cancelled
793       */
794      public void testCancelledForkTimedGet() throws Exception {
795 <        ForkJoinTask a = new CheckedFJTask() {
796 <            public void realCompute() throws Exception {
795 >        ForkJoinTask a = new CheckedRecursiveAction() {
796 >            protected void realCompute() throws Exception {
797                  CCF f = new LCCF(null, 8);
798                  assertTrue(f.cancel(true));
799                  assertSame(f, f.fork());
# Line 826 | Line 811 | public class CountedCompleterTest extend
811       * quietlyJoin of a forked task returns when task cancelled
812       */
813      public void testCancelledForkQuietlyJoin() {
814 <        ForkJoinTask a = new CheckedFJTask() {
815 <            public void realCompute() {
814 >        ForkJoinTask a = new CheckedRecursiveAction() {
815 >            protected void realCompute() {
816                  CCF f = new LCCF(null, 8);
817                  assertTrue(f.cancel(true));
818                  assertSame(f, f.fork());
# Line 842 | Line 827 | public class CountedCompleterTest extend
827       */
828      public void testGetPool() {
829          final ForkJoinPool mainPool = mainPool();
830 <        ForkJoinTask a = new CheckedFJTask() {
831 <            public void realCompute() {
830 >        ForkJoinTask a = new CheckedRecursiveAction() {
831 >            protected void realCompute() {
832                  assertSame(mainPool, getPool());
833              }};
834          testInvokeOnPool(mainPool, a);
# Line 853 | Line 838 | public class CountedCompleterTest extend
838       * getPool of non-FJ task returns null
839       */
840      public void testGetPool2() {
841 <        ForkJoinTask a = new CheckedFJTask() {
842 <            public void realCompute() {
841 >        ForkJoinTask a = new CheckedRecursiveAction() {
842 >            protected void realCompute() {
843                  assertNull(getPool());
844              }};
845          assertNull(a.invoke());
# Line 864 | Line 849 | public class CountedCompleterTest extend
849       * inForkJoinPool of executing task returns true
850       */
851      public void testInForkJoinPool() {
852 <        ForkJoinTask a = new CheckedFJTask() {
853 <            public void realCompute() {
852 >        ForkJoinTask a = new CheckedRecursiveAction() {
853 >            protected void realCompute() {
854                  assertTrue(inForkJoinPool());
855              }};
856          testInvokeOnPool(mainPool(), a);
# Line 875 | Line 860 | public class CountedCompleterTest extend
860       * inForkJoinPool of non-FJ task returns false
861       */
862      public void testInForkJoinPool2() {
863 <        ForkJoinTask a = new CheckedFJTask() {
864 <            public void realCompute() {
863 >        ForkJoinTask a = new CheckedRecursiveAction() {
864 >            protected void realCompute() {
865                  assertFalse(inForkJoinPool());
866              }};
867          assertNull(a.invoke());
# Line 886 | Line 871 | public class CountedCompleterTest extend
871       * setRawResult(null) succeeds
872       */
873      public void testSetRawResult() {
874 <        ForkJoinTask a = new CheckedFJTask() {
875 <            public void realCompute() {
874 >        ForkJoinTask a = new CheckedRecursiveAction() {
875 >            protected void realCompute() {
876                  setRawResult(null);
877                  assertNull(getRawResult());
878              }};
# Line 898 | Line 883 | public class CountedCompleterTest extend
883       * invoke task throws exception after invoking completeExceptionally
884       */
885      public void testCompleteExceptionally2() {
886 <        ForkJoinTask a = new CheckedFJTask() {
887 <            public void realCompute() {
886 >        ForkJoinTask a = new CheckedRecursiveAction() {
887 >            protected void realCompute() {
888                  CCF f = new LCCF(null, 8);
889                  f.completeExceptionally(new FJException());
890                  try {
# Line 916 | Line 901 | public class CountedCompleterTest extend
901       * invokeAll(t1, t2) invokes all task arguments
902       */
903      public void testInvokeAll2() {
904 <        ForkJoinTask a = new CheckedFJTask() {
905 <            public void realCompute() {
904 >        ForkJoinTask a = new CheckedRecursiveAction() {
905 >            protected void realCompute() {
906                  CCF f = new LCCF(null, 8);
907                  CCF g = new LCCF(null, 9);
908                  invokeAll(f, g);
# Line 933 | Line 918 | public class CountedCompleterTest extend
918       * invokeAll(tasks) with 1 argument invokes task
919       */
920      public void testInvokeAll1() {
921 <        ForkJoinTask a = new CheckedFJTask() {
922 <            public void realCompute() {
921 >        ForkJoinTask a = new CheckedRecursiveAction() {
922 >            protected void realCompute() {
923                  CCF f = new LCCF(null, 8);
924                  invokeAll(f);
925                  checkCompletedNormally(f);
# Line 947 | Line 932 | public class CountedCompleterTest extend
932       * invokeAll(tasks) with > 2 argument invokes tasks
933       */
934      public void testInvokeAll3() {
935 <        ForkJoinTask a = new CheckedFJTask() {
936 <            public void realCompute() {
935 >        ForkJoinTask a = new CheckedRecursiveAction() {
936 >            protected void realCompute() {
937                  CCF f = new LCCF(null, 8);
938                  CCF g = new LCCF(null, 9);
939                  CCF h = new LCCF(null, 7);
# Line 967 | Line 952 | public class CountedCompleterTest extend
952       * invokeAll(collection) invokes all tasks in the collection
953       */
954      public void testInvokeAllCollection() {
955 <        ForkJoinTask a = new CheckedFJTask() {
956 <            public void realCompute() {
955 >        ForkJoinTask a = new CheckedRecursiveAction() {
956 >            protected void realCompute() {
957                  CCF f = new LCCF(null, 8);
958                  CCF g = new LCCF(null, 9);
959                  CCF h = new LCCF(null, 7);
# Line 991 | Line 976 | public class CountedCompleterTest extend
976       * invokeAll(tasks) with any null task throws NPE
977       */
978      public void testInvokeAllNPE() {
979 <        ForkJoinTask a = new CheckedFJTask() {
980 <            public void realCompute() {
979 >        ForkJoinTask a = new CheckedRecursiveAction() {
980 >            protected void realCompute() {
981                  CCF f = new LCCF(null, 8);
982                  CCF g = new LCCF(null, 9);
983                  CCF h = null;
# Line 1008 | Line 993 | public class CountedCompleterTest extend
993       * invokeAll(t1, t2) throw exception if any task does
994       */
995      public void testAbnormalInvokeAll2() {
996 <        ForkJoinTask a = new CheckedFJTask() {
997 <            public void realCompute() {
996 >        ForkJoinTask a = new CheckedRecursiveAction() {
997 >            protected void realCompute() {
998                  CCF f = new LCCF(null, 8);
999                  FailingCCF g = new LFCCF(null, 9);
1000                  try {
# Line 1026 | Line 1011 | public class CountedCompleterTest extend
1011       * invokeAll(tasks) with 1 argument throws exception if task does
1012       */
1013      public void testAbnormalInvokeAll1() {
1014 <        ForkJoinTask a = new CheckedFJTask() {
1015 <            public void realCompute() {
1014 >        ForkJoinTask a = new CheckedRecursiveAction() {
1015 >            protected void realCompute() {
1016                  FailingCCF g = new LFCCF(null, 9);
1017                  try {
1018                      invokeAll(g);
# Line 1043 | Line 1028 | public class CountedCompleterTest extend
1028       * invokeAll(tasks) with > 2 argument throws exception if any task does
1029       */
1030      public void testAbnormalInvokeAll3() {
1031 <        ForkJoinTask a = new CheckedFJTask() {
1032 <            public void realCompute() {
1031 >        ForkJoinTask a = new CheckedRecursiveAction() {
1032 >            protected void realCompute() {
1033                  CCF f = new LCCF(null, 8);
1034                  FailingCCF g = new LFCCF(null, 9);
1035                  CCF h = new LCCF(null, 7);
# Line 1062 | Line 1047 | public class CountedCompleterTest extend
1047       * invokeAll(collection)  throws exception if any task does
1048       */
1049      public void testAbnormalInvokeAllCollection() {
1050 <        ForkJoinTask a = new CheckedFJTask() {
1051 <            public void realCompute() {
1050 >        ForkJoinTask a = new CheckedRecursiveAction() {
1051 >            protected void realCompute() {
1052                  FailingCCF f = new LFCCF(null, 8);
1053                  CCF g = new LCCF(null, 9);
1054                  CCF h = new LCCF(null, 7);
# Line 1086 | Line 1071 | public class CountedCompleterTest extend
1071       * and suppresses execution
1072       */
1073      public void testTryUnfork() {
1074 <        ForkJoinTask a = new CheckedFJTask() {
1075 <            public void realCompute() {
1074 >        ForkJoinTask a = new CheckedRecursiveAction() {
1075 >            protected void realCompute() {
1076                  CCF g = new LCCF(null, 9);
1077                  assertSame(g, g.fork());
1078                  CCF f = new LCCF(null, 8);
# Line 1105 | Line 1090 | public class CountedCompleterTest extend
1090       * there are more tasks than threads
1091       */
1092      public void testGetSurplusQueuedTaskCount() {
1093 <        ForkJoinTask a = new CheckedFJTask() {
1094 <            public void realCompute() {
1093 >        ForkJoinTask a = new CheckedRecursiveAction() {
1094 >            protected void realCompute() {
1095                  CCF h = new LCCF(null, 7);
1096                  assertSame(h, h.fork());
1097                  CCF g = new LCCF(null, 9);
# Line 1127 | Line 1112 | public class CountedCompleterTest extend
1112       * peekNextLocalTask returns most recent unexecuted task.
1113       */
1114      public void testPeekNextLocalTask() {
1115 <        ForkJoinTask a = new CheckedFJTask() {
1116 <            public void realCompute() {
1115 >        ForkJoinTask a = new CheckedRecursiveAction() {
1116 >            protected void realCompute() {
1117                  CCF g = new LCCF(null, 9);
1118                  assertSame(g, g.fork());
1119                  CCF f = new LCCF(null, 8);
# Line 1147 | Line 1132 | public class CountedCompleterTest extend
1132       * executing it
1133       */
1134      public void testPollNextLocalTask() {
1135 <        ForkJoinTask a = new CheckedFJTask() {
1136 <            public void realCompute() {
1135 >        ForkJoinTask a = new CheckedRecursiveAction() {
1136 >            protected void realCompute() {
1137                  CCF g = new LCCF(null, 9);
1138                  assertSame(g, g.fork());
1139                  CCF f = new LCCF(null, 8);
# Line 1166 | Line 1151 | public class CountedCompleterTest extend
1151       * pollTask returns an unexecuted task without executing it
1152       */
1153      public void testPollTask() {
1154 <        ForkJoinTask a = new CheckedFJTask() {
1155 <            public void realCompute() {
1154 >        ForkJoinTask a = new CheckedRecursiveAction() {
1155 >            protected void realCompute() {
1156                  CCF g = new LCCF(null, 9);
1157                  assertSame(g, g.fork());
1158                  CCF f = new LCCF(null, 8);
# Line 1184 | Line 1169 | public class CountedCompleterTest extend
1169       * peekNextLocalTask returns least recent unexecuted task in async mode
1170       */
1171      public void testPeekNextLocalTaskAsync() {
1172 <        ForkJoinTask a = new CheckedFJTask() {
1173 <            public void realCompute() {
1172 >        ForkJoinTask a = new CheckedRecursiveAction() {
1173 >            protected void realCompute() {
1174                  CCF g = new LCCF(null, 9);
1175                  assertSame(g, g.fork());
1176                  CCF f = new LCCF(null, 8);
# Line 1205 | Line 1190 | public class CountedCompleterTest extend
1190       * executing it, in async mode
1191       */
1192      public void testPollNextLocalTaskAsync() {
1193 <        ForkJoinTask a = new CheckedFJTask() {
1194 <            public void realCompute() {
1193 >        ForkJoinTask a = new CheckedRecursiveAction() {
1194 >            protected void realCompute() {
1195                  CCF g = new LCCF(null, 9);
1196                  assertSame(g, g.fork());
1197                  CCF f = new LCCF(null, 8);
# Line 1225 | Line 1210 | public class CountedCompleterTest extend
1210       * async mode
1211       */
1212      public void testPollTaskAsync() {
1213 <        ForkJoinTask a = new CheckedFJTask() {
1214 <            public void realCompute() {
1213 >        ForkJoinTask a = new CheckedRecursiveAction() {
1214 >            protected void realCompute() {
1215                  CCF g = new LCCF(null, 9);
1216                  assertSame(g, g.fork());
1217                  CCF f = new LCCF(null, 8);
# Line 1248 | Line 1233 | public class CountedCompleterTest extend
1233       * completed tasks; getRawResult returns null.
1234       */
1235      public void testInvokeSingleton() {
1236 <        ForkJoinTask a = new CheckedFJTask() {
1237 <            public void realCompute() {
1236 >        ForkJoinTask a = new CheckedRecursiveAction() {
1237 >            protected void realCompute() {
1238                  CCF f = new LCCF(null, 8);
1239                  assertNull(f.invoke());
1240                  assertEquals(21, f.number);
# Line 1264 | Line 1249 | public class CountedCompleterTest extend
1249       * completed tasks
1250       */
1251      public void testQuietlyInvokeSingleton() {
1252 <        ForkJoinTask a = new CheckedFJTask() {
1253 <            public void realCompute() {
1252 >        ForkJoinTask a = new CheckedRecursiveAction() {
1253 >            protected void realCompute() {
1254                  CCF f = new LCCF(null, 8);
1255                  f.quietlyInvoke();
1256                  assertEquals(21, f.number);
# Line 1278 | Line 1263 | public class CountedCompleterTest extend
1263       * join of a forked task returns when task completes
1264       */
1265      public void testForkJoinSingleton() {
1266 <        ForkJoinTask a = new CheckedFJTask() {
1267 <            public void realCompute() {
1266 >        ForkJoinTask a = new CheckedRecursiveAction() {
1267 >            protected void realCompute() {
1268                  CCF f = new LCCF(null, 8);
1269                  assertSame(f, f.fork());
1270                  assertNull(f.join());
# Line 1293 | Line 1278 | public class CountedCompleterTest extend
1278       * get of a forked task returns when task completes
1279       */
1280      public void testForkGetSingleton() {
1281 <        ForkJoinTask a = new CheckedFJTask() {
1282 <            public void realCompute() throws Exception {
1281 >        ForkJoinTask a = new CheckedRecursiveAction() {
1282 >            protected void realCompute() throws Exception {
1283                  CCF f = new LCCF(null, 8);
1284                  assertSame(f, f.fork());
1285                  assertNull(f.get());
# Line 1308 | Line 1293 | public class CountedCompleterTest extend
1293       * timed get of a forked task returns when task completes
1294       */
1295      public void testForkTimedGetSingleton() {
1296 <        ForkJoinTask a = new CheckedFJTask() {
1297 <            public void realCompute() throws Exception {
1296 >        ForkJoinTask a = new CheckedRecursiveAction() {
1297 >            protected void realCompute() throws Exception {
1298                  CCF f = new LCCF(null, 8);
1299                  assertSame(f, f.fork());
1300                  assertNull(f.get(LONG_DELAY_MS, MILLISECONDS));
# Line 1323 | Line 1308 | public class CountedCompleterTest extend
1308       * timed get with null time unit throws NPE
1309       */
1310      public void testForkTimedGetNPESingleton() {
1311 <        ForkJoinTask a = new CheckedFJTask() {
1312 <            public void realCompute() throws Exception {
1311 >        ForkJoinTask a = new CheckedRecursiveAction() {
1312 >            protected void realCompute() throws Exception {
1313                  CCF f = new LCCF(null, 8);
1314                  assertSame(f, f.fork());
1315                  try {
# Line 1339 | Line 1324 | public class CountedCompleterTest extend
1324       * quietlyJoin of a forked task returns when task completes
1325       */
1326      public void testForkQuietlyJoinSingleton() {
1327 <        ForkJoinTask a = new CheckedFJTask() {
1328 <            public void realCompute() {
1327 >        ForkJoinTask a = new CheckedRecursiveAction() {
1328 >            protected void realCompute() {
1329                  CCF f = new LCCF(null, 8);
1330                  assertSame(f, f.fork());
1331                  f.quietlyJoin();
# Line 1355 | Line 1340 | public class CountedCompleterTest extend
1340       * getQueuedTaskCount returns 0 when quiescent
1341       */
1342      public void testForkHelpQuiesceSingleton() {
1343 <        ForkJoinTask a = new CheckedFJTask() {
1344 <            public void realCompute() {
1343 >        ForkJoinTask a = new CheckedRecursiveAction() {
1344 >            protected void realCompute() {
1345                  CCF f = new LCCF(null, 8);
1346                  assertSame(f, f.fork());
1347                  helpQuiesce();
# Line 1371 | Line 1356 | public class CountedCompleterTest extend
1356       * invoke task throws exception when task completes abnormally
1357       */
1358      public void testAbnormalInvokeSingleton() {
1359 <        ForkJoinTask a = new CheckedFJTask() {
1360 <            public void realCompute() {
1359 >        ForkJoinTask a = new CheckedRecursiveAction() {
1360 >            protected void realCompute() {
1361                  FailingCCF f = new LFCCF(null, 8);
1362                  try {
1363                      f.invoke();
# Line 1388 | Line 1373 | public class CountedCompleterTest extend
1373       * quietlyInvoke task returns when task completes abnormally
1374       */
1375      public void testAbnormalQuietlyInvokeSingleton() {
1376 <        ForkJoinTask a = new CheckedFJTask() {
1377 <            public void realCompute() {
1376 >        ForkJoinTask a = new CheckedRecursiveAction() {
1377 >            protected void realCompute() {
1378                  FailingCCF f = new LFCCF(null, 8);
1379                  f.quietlyInvoke();
1380                  assertTrue(f.getException() instanceof FJException);
# Line 1402 | Line 1387 | public class CountedCompleterTest extend
1387       * join of a forked task throws exception when task completes abnormally
1388       */
1389      public void testAbnormalForkJoinSingleton() {
1390 <        ForkJoinTask a = new CheckedFJTask() {
1391 <            public void realCompute() {
1390 >        ForkJoinTask a = new CheckedRecursiveAction() {
1391 >            protected void realCompute() {
1392                  FailingCCF f = new LFCCF(null, 8);
1393                  assertSame(f, f.fork());
1394                  try {
# Line 1420 | Line 1405 | public class CountedCompleterTest extend
1405       * get of a forked task throws exception when task completes abnormally
1406       */
1407      public void testAbnormalForkGetSingleton() {
1408 <        ForkJoinTask a = new CheckedFJTask() {
1409 <            public void realCompute() throws Exception {
1408 >        ForkJoinTask a = new CheckedRecursiveAction() {
1409 >            protected void realCompute() throws Exception {
1410                  FailingCCF f = new LFCCF(null, 8);
1411                  assertSame(f, f.fork());
1412                  try {
# Line 1440 | Line 1425 | public class CountedCompleterTest extend
1425       * timed get of a forked task throws exception when task completes abnormally
1426       */
1427      public void testAbnormalForkTimedGetSingleton() {
1428 <        ForkJoinTask a = new CheckedFJTask() {
1429 <            public void realCompute() throws Exception {
1428 >        ForkJoinTask a = new CheckedRecursiveAction() {
1429 >            protected void realCompute() throws Exception {
1430                  FailingCCF f = new LFCCF(null, 8);
1431                  assertSame(f, f.fork());
1432                  try {
# Line 1460 | Line 1445 | public class CountedCompleterTest extend
1445       * quietlyJoin of a forked task returns when task completes abnormally
1446       */
1447      public void testAbnormalForkQuietlyJoinSingleton() {
1448 <        ForkJoinTask a = new CheckedFJTask() {
1449 <            public void realCompute() {
1448 >        ForkJoinTask a = new CheckedRecursiveAction() {
1449 >            protected void realCompute() {
1450                  FailingCCF f = new LFCCF(null, 8);
1451                  assertSame(f, f.fork());
1452                  f.quietlyJoin();
# Line 1475 | Line 1460 | public class CountedCompleterTest extend
1460       * invoke task throws exception when task cancelled
1461       */
1462      public void testCancelledInvokeSingleton() {
1463 <        ForkJoinTask a = new CheckedFJTask() {
1464 <            public void realCompute() {
1463 >        ForkJoinTask a = new CheckedRecursiveAction() {
1464 >            protected void realCompute() {
1465                  CCF f = new LCCF(null, 8);
1466                  assertTrue(f.cancel(true));
1467                  try {
# Line 1493 | Line 1478 | public class CountedCompleterTest extend
1478       * join of a forked task throws exception when task cancelled
1479       */
1480      public void testCancelledForkJoinSingleton() {
1481 <        ForkJoinTask a = new CheckedFJTask() {
1482 <            public void realCompute() {
1481 >        ForkJoinTask a = new CheckedRecursiveAction() {
1482 >            protected void realCompute() {
1483                  CCF f = new LCCF(null, 8);
1484                  assertTrue(f.cancel(true));
1485                  assertSame(f, f.fork());
# Line 1512 | Line 1497 | public class CountedCompleterTest extend
1497       * get of a forked task throws exception when task cancelled
1498       */
1499      public void testCancelledForkGetSingleton() {
1500 <        ForkJoinTask a = new CheckedFJTask() {
1501 <            public void realCompute() throws Exception {
1500 >        ForkJoinTask a = new CheckedRecursiveAction() {
1501 >            protected void realCompute() throws Exception {
1502                  CCF f = new LCCF(null, 8);
1503                  assertTrue(f.cancel(true));
1504                  assertSame(f, f.fork());
# Line 1531 | Line 1516 | public class CountedCompleterTest extend
1516       * timed get of a forked task throws exception when task cancelled
1517       */
1518      public void testCancelledForkTimedGetSingleton() throws Exception {
1519 <        ForkJoinTask a = new CheckedFJTask() {
1520 <            public void realCompute() throws Exception {
1519 >        ForkJoinTask a = new CheckedRecursiveAction() {
1520 >            protected void realCompute() throws Exception {
1521                  CCF f = new LCCF(null, 8);
1522                  assertTrue(f.cancel(true));
1523                  assertSame(f, f.fork());
# Line 1550 | Line 1535 | public class CountedCompleterTest extend
1535       * quietlyJoin of a forked task returns when task cancelled
1536       */
1537      public void testCancelledForkQuietlyJoinSingleton() {
1538 <        ForkJoinTask a = new CheckedFJTask() {
1539 <            public void realCompute() {
1538 >        ForkJoinTask a = new CheckedRecursiveAction() {
1539 >            protected void realCompute() {
1540                  CCF f = new LCCF(null, 8);
1541                  assertTrue(f.cancel(true));
1542                  assertSame(f, f.fork());
# Line 1565 | Line 1550 | public class CountedCompleterTest extend
1550       * invoke task throws exception after invoking completeExceptionally
1551       */
1552      public void testCompleteExceptionallySingleton() {
1553 <        ForkJoinTask a = new CheckedFJTask() {
1554 <            public void realCompute() {
1553 >        ForkJoinTask a = new CheckedRecursiveAction() {
1554 >            protected void realCompute() {
1555                  CCF f = new LCCF(null, 8);
1556                  f.completeExceptionally(new FJException());
1557                  try {
# Line 1583 | Line 1568 | public class CountedCompleterTest extend
1568       * invokeAll(t1, t2) invokes all task arguments
1569       */
1570      public void testInvokeAll2Singleton() {
1571 <        ForkJoinTask a = new CheckedFJTask() {
1572 <            public void realCompute() {
1571 >        ForkJoinTask a = new CheckedRecursiveAction() {
1572 >            protected void realCompute() {
1573                  CCF f = new LCCF(null, 8);
1574                  CCF g = new LCCF(null, 9);
1575                  invokeAll(f, g);
# Line 1600 | Line 1585 | public class CountedCompleterTest extend
1585       * invokeAll(tasks) with 1 argument invokes task
1586       */
1587      public void testInvokeAll1Singleton() {
1588 <        ForkJoinTask a = new CheckedFJTask() {
1589 <            public void realCompute() {
1588 >        ForkJoinTask a = new CheckedRecursiveAction() {
1589 >            protected void realCompute() {
1590                  CCF f = new LCCF(null, 8);
1591                  invokeAll(f);
1592                  checkCompletedNormally(f);
# Line 1614 | Line 1599 | public class CountedCompleterTest extend
1599       * invokeAll(tasks) with > 2 argument invokes tasks
1600       */
1601      public void testInvokeAll3Singleton() {
1602 <        ForkJoinTask a = new CheckedFJTask() {
1603 <            public void realCompute() {
1602 >        ForkJoinTask a = new CheckedRecursiveAction() {
1603 >            protected void realCompute() {
1604                  CCF f = new LCCF(null, 8);
1605                  CCF g = new LCCF(null, 9);
1606                  CCF h = new LCCF(null, 7);
# Line 1634 | Line 1619 | public class CountedCompleterTest extend
1619       * invokeAll(collection) invokes all tasks in the collection
1620       */
1621      public void testInvokeAllCollectionSingleton() {
1622 <        ForkJoinTask a = new CheckedFJTask() {
1623 <            public void realCompute() {
1622 >        ForkJoinTask a = new CheckedRecursiveAction() {
1623 >            protected void realCompute() {
1624                  CCF f = new LCCF(null, 8);
1625                  CCF g = new LCCF(null, 9);
1626                  CCF h = new LCCF(null, 7);
# Line 1658 | Line 1643 | public class CountedCompleterTest extend
1643       * invokeAll(tasks) with any null task throws NPE
1644       */
1645      public void testInvokeAllNPESingleton() {
1646 <        ForkJoinTask a = new CheckedFJTask() {
1647 <            public void realCompute() {
1646 >        ForkJoinTask a = new CheckedRecursiveAction() {
1647 >            protected void realCompute() {
1648                  CCF f = new LCCF(null, 8);
1649                  CCF g = new LCCF(null, 9);
1650                  CCF h = null;
# Line 1675 | Line 1660 | public class CountedCompleterTest extend
1660       * invokeAll(t1, t2) throw exception if any task does
1661       */
1662      public void testAbnormalInvokeAll2Singleton() {
1663 <        ForkJoinTask a = new CheckedFJTask() {
1664 <            public void realCompute() {
1663 >        ForkJoinTask a = new CheckedRecursiveAction() {
1664 >            protected void realCompute() {
1665                  CCF f = new LCCF(null, 8);
1666                  FailingCCF g = new LFCCF(null, 9);
1667                  try {
# Line 1693 | Line 1678 | public class CountedCompleterTest extend
1678       * invokeAll(tasks) with 1 argument throws exception if task does
1679       */
1680      public void testAbnormalInvokeAll1Singleton() {
1681 <        ForkJoinTask a = new CheckedFJTask() {
1682 <            public void realCompute() {
1681 >        ForkJoinTask a = new CheckedRecursiveAction() {
1682 >            protected void realCompute() {
1683                  FailingCCF g = new LFCCF(null, 9);
1684                  try {
1685                      invokeAll(g);
# Line 1710 | Line 1695 | public class CountedCompleterTest extend
1695       * invokeAll(tasks) with > 2 argument throws exception if any task does
1696       */
1697      public void testAbnormalInvokeAll3Singleton() {
1698 <        ForkJoinTask a = new CheckedFJTask() {
1699 <            public void realCompute() {
1698 >        ForkJoinTask a = new CheckedRecursiveAction() {
1699 >            protected void realCompute() {
1700                  CCF f = new LCCF(null, 8);
1701                  FailingCCF g = new LFCCF(null, 9);
1702                  CCF h = new LCCF(null, 7);
# Line 1729 | Line 1714 | public class CountedCompleterTest extend
1714       * invokeAll(collection)  throws exception if any task does
1715       */
1716      public void testAbnormalInvokeAllCollectionSingleton() {
1717 <        ForkJoinTask a = new CheckedFJTask() {
1718 <            public void realCompute() {
1717 >        ForkJoinTask a = new CheckedRecursiveAction() {
1718 >            protected void realCompute() {
1719                  FailingCCF f = new LFCCF(null, 8);
1720                  CCF g = new LCCF(null, 9);
1721                  CCF h = new LCCF(null, 7);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines