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.7 by jsr166, Mon Jun 3 18:20:05 2013 UTC vs.
Revision 1.8 by jsr166, Tue Jun 4 23:07:11 2013 UTC

# Line 12 | Line 12 | import java.util.concurrent.ForkJoinWork
12   import java.util.concurrent.RecursiveAction;
13   import java.util.concurrent.TimeUnit;
14   import java.util.concurrent.TimeoutException;
15 + import java.util.concurrent.atomic.AtomicInteger;
16   import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
17 + import java.util.concurrent.atomic.AtomicReference;
18   import static java.util.concurrent.TimeUnit.MILLISECONDS;
19   import static java.util.concurrent.TimeUnit.SECONDS;
20   import java.util.HashSet;
# Line 83 | Line 85 | public class CountedCompleterTest extend
85          } catch (Throwable fail) { threadUnexpectedException(fail); }
86      }
87  
88 <    <T> void checkCompletedNormally(CountedCompleter<T> a) {
87 <        checkCompletedNormally(a, null);
88 <    }
89 <
90 <    <T> void checkCompletedNormally(CountedCompleter<T> a, T expected) {
88 >    void checkCompletedNormally(CountedCompleter<?> a) {
89          assertTrue(a.isDone());
90          assertFalse(a.isCancelled());
91          assertTrue(a.isCompletedNormally());
92          assertFalse(a.isCompletedAbnormally());
93          assertNull(a.getException());
94 <        assertSame(expected, a.getRawResult());
94 >        assertNull(a.getRawResult());
95  
96          {
97              Thread.currentThread().interrupt();
98              long t0 = System.nanoTime();
99 <            assertSame(expected, a.join());
99 >            assertNull(a.join());
100              assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
101              Thread.interrupted();
102          }
# Line 114 | Line 112 | public class CountedCompleterTest extend
112          assertFalse(a.cancel(false));
113          assertFalse(a.cancel(true));
114          try {
115 <            assertSame(expected, a.get());
115 >            assertNull(a.get());
116          } catch (Throwable fail) { threadUnexpectedException(fail); }
117          try {
118 <            assertSame(expected, a.get(5L, SECONDS));
118 >            assertNull(a.get(5L, SECONDS));
119          } catch (Throwable fail) { threadUnexpectedException(fail); }
120      }
121  
# Line 196 | Line 194 | public class CountedCompleterTest extend
194          } catch (ExecutionException success) {
195              assertSame(t.getClass(), success.getCause().getClass());
196          } catch (Throwable fail) { threadUnexpectedException(fail); }
197 +
198 +        try {
199 +            a.invoke();
200 +            shouldThrow();
201 +        } catch (Throwable ex) {
202 +            assertSame(t, ex);
203 +        }
204      }
205  
206      public static final class FJException extends RuntimeException {
207          FJException() { super(); }
208      }
209  
210 <    static final class NoopCountedCompleter extends CountedCompleter {
211 <        boolean post; // set true if onCompletion called
212 <        NoopCountedCompleter() { super(); }
213 <        NoopCountedCompleter(CountedCompleter p) { super(p); }
214 <        public void compute() {}
215 <        public final void onCompletion(CountedCompleter caller) {
216 <            post = true;
210 >    abstract class CheckedCC extends CountedCompleter<Object> {
211 >        final AtomicInteger computeN = new AtomicInteger(0);
212 >        final AtomicInteger onCompletionN = new AtomicInteger(0);
213 >        final AtomicInteger onExceptionalCompletionN = new AtomicInteger(0);
214 >        final AtomicInteger setRawResultN = new AtomicInteger(0);
215 >        final AtomicReference<Object> rawResult = new AtomicReference<>(null);
216 >        int computeN() { return computeN.get(); }
217 >        int onCompletionN() { return onCompletionN.get(); }
218 >        int onExceptionalCompletionN() { return onExceptionalCompletionN.get(); }
219 >        int setRawResultN() { return setRawResultN.get(); }
220 >
221 >        CheckedCC() { super(); }
222 >        CheckedCC(CountedCompleter p) { super(p); }
223 >        CheckedCC(CountedCompleter p, int n) { super(p, n); }
224 >        abstract void realCompute();
225 >        public final void compute() {
226 >            computeN.incrementAndGet();
227 >            realCompute();
228 >        }
229 >        public void onCompletion(CountedCompleter caller) {
230 >            onCompletionN.incrementAndGet();
231 >            super.onCompletion(caller);
232 >        }
233 >        public boolean onExceptionalCompletion(Throwable ex,
234 >                                               CountedCompleter caller) {
235 >            onExceptionalCompletionN.incrementAndGet();
236 >            assertNotNull(ex);
237 >            assertTrue(isCompletedAbnormally());
238 >            assertTrue(super.onExceptionalCompletion(ex, caller));
239 >            return true;
240 >        }
241 >        protected void setRawResult(Object t) {
242 >            setRawResultN.incrementAndGet();
243 >            rawResult.set(t);
244 >            super.setRawResult(t);
245 >        }
246 >        void checkIncomplete() {
247 >            assertEquals(0, computeN());
248 >            assertEquals(0, onCompletionN());
249 >            assertEquals(0, onExceptionalCompletionN());
250 >            assertEquals(0, setRawResultN());
251 >            checkNotDone(this);
252 >        }
253 >        void checkCompletes(Object rawResult) {
254 >            checkIncomplete();
255 >            complete(rawResult);
256 >            assertEquals(0, computeN());
257 >            assertEquals(1, onCompletionN());
258 >            assertEquals(0, onExceptionalCompletionN());
259 >            assertEquals(1, setRawResultN());
260 >            assertSame(rawResult, this.rawResult.get());
261 >            checkCompletedNormally(this);
262 >        }
263 >        void checkCompletesExceptionally(Throwable ex) {
264 >            checkIncomplete();
265 >            completeExceptionally(ex);
266 >            checkCompletedExceptionally(ex);
267 >        }
268 >        void checkCompletedExceptionally(Throwable ex) {
269 >            assertEquals(0, computeN());
270 >            assertEquals(0, onCompletionN());
271 >            assertEquals(1, onExceptionalCompletionN());
272 >            assertEquals(0, setRawResultN());
273 >            assertNull(this.rawResult.get());
274 >            checkCompletedAbnormally(this, ex);
275          }
276      }
277  
278 +    final class NoopCC extends CheckedCC {
279 +        NoopCC() { super(); }
280 +        NoopCC(CountedCompleter p) { super(p); }
281 +        protected void realCompute() {}
282 +    }
283 +
284      /**
285       * A newly constructed CountedCompleter is not completed;
286       * complete() causes completion.
287       */
288      public void testComplete() {
289 <        NoopCountedCompleter a = new NoopCountedCompleter();
290 <        assertFalse(a.isDone());
291 <        assertFalse(a.isCompletedNormally());
292 <        assertFalse(a.isCompletedAbnormally());
293 <        assertFalse(a.isCancelled());
294 <        assertNull(a.getException());
226 <        assertNull(a.getRawResult());
227 <        assertFalse(a.post);
228 <        a.complete(null);
229 <        assertTrue(a.post);
230 <        assertTrue(a.isDone());
231 <        assertTrue(a.isCompletedNormally());
232 <        assertFalse(a.isCompletedAbnormally());
233 <        assertFalse(a.isCancelled());
234 <        assertNull(a.getException());
235 <        assertNull(a.getRawResult());
289 >        for (Object x : new Object[] { Boolean.TRUE, null }) {
290 >            new NoopCC()
291 >                .checkCompletes(x);
292 >            new NoopCC(new NoopCC())
293 >                .checkCompletes(x);
294 >        }
295      }
296  
297      /**
298       * completeExceptionally completes exceptionally
299       */
300      public void testCompleteExceptionally() {
301 <        NoopCountedCompleter a = new NoopCountedCompleter();
302 <        assertFalse(a.isDone());
303 <        assertFalse(a.isCompletedNormally());
304 <        assertFalse(a.isCompletedAbnormally());
305 <        assertFalse(a.isCancelled());
306 <        assertNull(a.getException());
307 <        assertNull(a.getRawResult());
308 <        assertFalse(a.post);
309 <        a.completeExceptionally(new FJException());
310 <        assertFalse(a.post);
311 <        assertTrue(a.isDone());
312 <        assertFalse(a.isCompletedNormally());
313 <        assertTrue(a.isCompletedAbnormally());
314 <        assertFalse(a.isCancelled());
315 <        assertTrue(a.getException() instanceof FJException);
257 <        assertNull(a.getRawResult());
301 >        new NoopCC()
302 >            .checkCompletesExceptionally(new FJException());
303 >        new NoopCC(new NoopCC())
304 >            .checkCompletesExceptionally(new FJException());
305 >    }
306 >
307 >    /**
308 >     * completeExceptionally(null) throws NullPointerException
309 >     */
310 >    public void testCompleteExceptionally_null() {
311 >        try {
312 >            new NoopCC()
313 >                .checkCompletesExceptionally(null);
314 >            shouldThrow();
315 >        } catch (NullPointerException success) {}
316      }
317  
318      /**
319       * setPendingCount sets the reported pending count
320       */
321      public void testSetPendingCount() {
322 <        NoopCountedCompleter a = new NoopCountedCompleter();
322 >        NoopCC a = new NoopCC();
323          assertEquals(0, a.getPendingCount());
324          a.setPendingCount(1);
325          assertEquals(1, a.getPendingCount());
# Line 273 | Line 331 | public class CountedCompleterTest extend
331       * addToPendingCount adds to the reported pending count
332       */
333      public void testAddToPendingCount() {
334 <        NoopCountedCompleter a = new NoopCountedCompleter();
334 >        NoopCC a = new NoopCC();
335          assertEquals(0, a.getPendingCount());
336          a.addToPendingCount(1);
337          assertEquals(1, a.getPendingCount());
# Line 286 | Line 344 | public class CountedCompleterTest extend
344       * count unless zero
345       */
346      public void testDecrementPendingCount() {
347 <        NoopCountedCompleter a = new NoopCountedCompleter();
347 >        NoopCC a = new NoopCC();
348          assertEquals(0, a.getPendingCount());
349          a.addToPendingCount(1);
350          assertEquals(1, a.getPendingCount());
# Line 297 | Line 355 | public class CountedCompleterTest extend
355      }
356  
357      /**
358 +     * compareAndSetPendingCount compares and sets the reported
359 +     * pending count
360 +     */
361 +    public void testCompareAndSetPendingCount() {
362 +        NoopCC a = new NoopCC();
363 +        assertEquals(0, a.getPendingCount());
364 +        assertTrue(a.compareAndSetPendingCount(0, 1));
365 +        assertEquals(1, a.getPendingCount());
366 +        assertTrue(a.compareAndSetPendingCount(1, 2));
367 +        assertEquals(2, a.getPendingCount());
368 +        assertFalse(a.compareAndSetPendingCount(1, 3));
369 +        assertEquals(2, a.getPendingCount());
370 +    }
371 +
372 +    /**
373       * getCompleter returns parent or null if at root
374       */
375      public void testGetCompleter() {
376 <        NoopCountedCompleter a = new NoopCountedCompleter();
376 >        NoopCC a = new NoopCC();
377          assertNull(a.getCompleter());
378 <        CountedCompleter b = new NoopCountedCompleter(a);
379 <        assertEquals(a, b.getCompleter());
378 >        CountedCompleter b = new NoopCC(a);
379 >        assertSame(a, b.getCompleter());
380 >        CountedCompleter c = new NoopCC(b);
381 >        assertSame(b, c.getCompleter());
382      }
383  
384      /**
385       * getRoot returns self if no parent, else parent's root
386       */
387      public void testGetRoot() {
388 <        NoopCountedCompleter a = new NoopCountedCompleter();
389 <        NoopCountedCompleter b = new NoopCountedCompleter(a);
390 <        assertEquals(a, a.getRoot());
391 <        assertEquals(a, b.getRoot());
388 >        NoopCC a = new NoopCC();
389 >        NoopCC b = new NoopCC(a);
390 >        NoopCC c = new NoopCC(b);
391 >        assertSame(a, a.getRoot());
392 >        assertSame(a, b.getRoot());
393 >        assertSame(a, c.getRoot());
394      }
395  
396      /**
397 <     * tryComplete causes completion if pending count is zero
397 >     * tryComplete decrements pending count unless zero, in which case
398 >     * causes completion
399       */
400 <    public void testTryComplete1() {
401 <        NoopCountedCompleter a = new NoopCountedCompleter();
400 >    public void testTryComplete() {
401 >        NoopCC a = new NoopCC();
402          assertEquals(0, a.getPendingCount());
403 +        int n = 3;
404 +        a.setPendingCount(n);
405 +        for (; n > 0; n--) {
406 +            assertEquals(n, a.getPendingCount());
407 +            a.tryComplete();
408 +            a.checkIncomplete();
409 +            assertEquals(n - 1, a.getPendingCount());
410 +        }
411          a.tryComplete();
412 <        assertTrue(a.post);
413 <        assertTrue(a.isDone());
412 >        assertEquals(0, a.computeN());
413 >        assertEquals(1, a.onCompletionN());
414 >        assertEquals(0, a.onExceptionalCompletionN());
415 >        assertEquals(0, a.setRawResultN());
416 >        checkCompletedNormally(a);
417      }
418  
419      /**
420 <     * propagateCompletion causes completion without invoking
421 <     * onCompletion if pending count is zero
420 >     * propagateCompletion decrements pending count unless zero, in
421 >     * which case causes completion, without invoking onCompletion
422       */
423      public void testPropagateCompletion() {
424 <        NoopCountedCompleter a = new NoopCountedCompleter();
424 >        NoopCC a = new NoopCC();
425          assertEquals(0, a.getPendingCount());
426 +        int n = 3;
427 +        a.setPendingCount(n);
428 +        for (; n > 0; n--) {
429 +            assertEquals(n, a.getPendingCount());
430 +            a.propagateCompletion();
431 +            a.checkIncomplete();
432 +            assertEquals(n - 1, a.getPendingCount());
433 +        }
434          a.propagateCompletion();
435 <        assertFalse(a.post);
436 <        assertTrue(a.isDone());
437 <    }
438 <
439 <    /**
343 <     * tryComplete decrements pending count unless zero
344 <     */
345 <    public void testTryComplete2() {
346 <        NoopCountedCompleter a = new NoopCountedCompleter();
347 <        assertEquals(0, a.getPendingCount());
348 <        a.setPendingCount(1);
349 <        a.tryComplete();
350 <        assertFalse(a.post);
351 <        assertFalse(a.isDone());
352 <        assertEquals(0, a.getPendingCount());
353 <        a.tryComplete();
354 <        assertTrue(a.post);
355 <        assertTrue(a.isDone());
435 >        assertEquals(0, a.computeN());
436 >        assertEquals(0, a.onCompletionN());
437 >        assertEquals(0, a.onExceptionalCompletionN());
438 >        assertEquals(0, a.setRawResultN());
439 >        checkCompletedNormally(a);
440      }
441  
442      /**
443       * firstComplete returns this if pending count is zero else null
444       */
445      public void testFirstComplete() {
446 <        NoopCountedCompleter a = new NoopCountedCompleter();
446 >        NoopCC a = new NoopCC();
447          a.setPendingCount(1);
448          assertNull(a.firstComplete());
449          assertEquals(a, a.firstComplete());
# Line 370 | Line 454 | public class CountedCompleterTest extend
454       * zero else null
455       */
456      public void testNextComplete() {
457 <        NoopCountedCompleter a = new NoopCountedCompleter();
458 <        NoopCountedCompleter b = new NoopCountedCompleter(a);
457 >        NoopCC a = new NoopCC();
458 >        NoopCC b = new NoopCC(a);
459          a.setPendingCount(1);
460          b.setPendingCount(1);
461          assertNull(b.firstComplete());
462          CountedCompleter c = b.firstComplete();
463 <        assertEquals(b, c);
463 >        assertSame(b, c);
464          CountedCompleter d = c.nextComplete();
465          assertNull(d);
466          CountedCompleter e = c.nextComplete();
467 <        assertEquals(a, e);
467 >        assertSame(a, e);
468      }
469  
470      /**
471       * quietlyCompleteRoot completes root task
472       */
473      public void testQuietlyCompleteRoot() {
474 <        NoopCountedCompleter a = new NoopCountedCompleter();
475 <        NoopCountedCompleter b = new NoopCountedCompleter(a);
474 >        NoopCC a = new NoopCC();
475 >        NoopCC b = new NoopCC(a);
476 >        NoopCC c = new NoopCC(b);
477          a.setPendingCount(1);
478          b.setPendingCount(1);
479 <        b.quietlyCompleteRoot();
479 >        c.setPendingCount(1);
480 >        c.quietlyCompleteRoot();
481          assertTrue(a.isDone());
482          assertFalse(b.isDone());
483 +        assertFalse(c.isDone());
484      }
485  
486      // Invocation tests use some interdependent task classes
# Line 401 | Line 488 | public class CountedCompleterTest extend
488  
489  
490      // Version of Fibonacci with different classes for left vs right forks
491 <    abstract static class CCF extends CountedCompleter {
491 >    abstract class CCF extends CheckedCC {
492          int number;
493          int rnumber;
494  
# Line 410 | Line 497 | public class CountedCompleterTest extend
497              this.number = n;
498          }
499  
500 <        public final void compute() {
414 <            CountedCompleter p;
500 >        protected final void realCompute() {
501              CCF f = this;
502              int n = number;
503              while (n >= 2) {
504                  new RCCF(f, n - 2).fork();
505                  f = new LCCF(f, --n);
506              }
507 <            f.number = n;
422 <            f.onCompletion(f);
423 <            if ((p = f.getCompleter()) != null)
424 <                p.tryComplete();
425 <            else
426 <                f.quietlyComplete();
507 >            f.complete(null);
508          }
509      }
510  
511 <    static final class LCCF extends CCF {
511 >    final class LCCF extends CCF {
512 >        public LCCF(int n) { this(null, n); }
513          public LCCF(CountedCompleter parent, int n) {
514              super(parent, n);
515          }
516          public final void onCompletion(CountedCompleter caller) {
517 +            super.onCompletion(caller);
518              CCF p = (CCF)getCompleter();
519              int n = number + rnumber;
520              if (p != null)
# Line 440 | Line 523 | public class CountedCompleterTest extend
523                  number = n;
524          }
525      }
526 <    static final class RCCF extends CCF {
526 >    final class RCCF extends CCF {
527          public RCCF(CountedCompleter parent, int n) {
528              super(parent, n);
529          }
530          public final void onCompletion(CountedCompleter caller) {
531 +            super.onCompletion(caller);
532              CCF p = (CCF)getCompleter();
533              int n = number + rnumber;
534              if (p != null)
# Line 455 | Line 539 | public class CountedCompleterTest extend
539      }
540  
541      // Version of CCF with forced failure in left completions
542 <    abstract static class FailingCCF extends CountedCompleter {
542 >    abstract class FailingCCF extends CheckedCC {
543          int number;
544          int rnumber;
545  
# Line 464 | Line 548 | public class CountedCompleterTest extend
548              this.number = n;
549          }
550  
551 <        public final void compute() {
468 <            CountedCompleter p;
551 >        protected final void realCompute() {
552              FailingCCF f = this;
553              int n = number;
554              while (n >= 2) {
555                  new RFCCF(f, n - 2).fork();
556                  f = new LFCCF(f, --n);
557              }
558 <            f.number = n;
476 <            f.onCompletion(f);
477 <            if ((p = f.getCompleter()) != null)
478 <                p.tryComplete();
479 <            else
480 <                f.quietlyComplete();
558 >            f.complete(null);
559          }
560      }
561  
562 <    static final class LFCCF extends FailingCCF {
562 >    final class LFCCF extends FailingCCF {
563 >        public LFCCF(int n) { this(null, n); }
564          public LFCCF(CountedCompleter parent, int n) {
565              super(parent, n);
566          }
567          public final void onCompletion(CountedCompleter caller) {
568 +            super.onCompletion(caller);
569              FailingCCF p = (FailingCCF)getCompleter();
570              int n = number + rnumber;
571              if (p != null)
# Line 494 | Line 574 | public class CountedCompleterTest extend
574                  number = n;
575          }
576      }
577 <    static final class RFCCF extends FailingCCF {
577 >    final class RFCCF extends FailingCCF {
578          public RFCCF(CountedCompleter parent, int n) {
579              super(parent, n);
580          }
581          public final void onCompletion(CountedCompleter caller) {
582 +            super.onCompletion(caller);
583              completeExceptionally(new FJException());
584          }
585      }
# Line 511 | Line 592 | public class CountedCompleterTest extend
592      public void testInvoke() {
593          ForkJoinTask a = new CheckedRecursiveAction() {
594              protected void realCompute() {
595 <                CCF f = new LCCF(null, 8);
595 >                CCF f = new LCCF(8);
596                  assertNull(f.invoke());
597                  assertEquals(21, f.number);
598                  checkCompletedNormally(f);
# Line 527 | Line 608 | public class CountedCompleterTest extend
608      public void testQuietlyInvoke() {
609          ForkJoinTask a = new CheckedRecursiveAction() {
610              protected void realCompute() {
611 <                CCF f = new LCCF(null, 8);
611 >                CCF f = new LCCF(8);
612                  f.quietlyInvoke();
613                  assertEquals(21, f.number);
614                  checkCompletedNormally(f);
# Line 541 | Line 622 | public class CountedCompleterTest extend
622      public void testForkJoin() {
623          ForkJoinTask a = new CheckedRecursiveAction() {
624              protected void realCompute() {
625 <                CCF f = new LCCF(null, 8);
625 >                CCF f = new LCCF(8);
626                  assertSame(f, f.fork());
627                  assertNull(f.join());
628                  assertEquals(21, f.number);
# Line 556 | Line 637 | public class CountedCompleterTest extend
637      public void testForkGet() {
638          ForkJoinTask a = new CheckedRecursiveAction() {
639              protected void realCompute() throws Exception {
640 <                CCF f = new LCCF(null, 8);
640 >                CCF f = new LCCF(8);
641                  assertSame(f, f.fork());
642                  assertNull(f.get());
643                  assertEquals(21, f.number);
# Line 571 | Line 652 | public class CountedCompleterTest extend
652      public void testForkTimedGet() {
653          ForkJoinTask a = new CheckedRecursiveAction() {
654              protected void realCompute() throws Exception {
655 <                CCF f = new LCCF(null, 8);
655 >                CCF f = new LCCF(8);
656                  assertSame(f, f.fork());
657                  assertNull(f.get(LONG_DELAY_MS, MILLISECONDS));
658                  assertEquals(21, f.number);
# Line 586 | Line 667 | public class CountedCompleterTest extend
667      public void testForkTimedGetNPE() {
668          ForkJoinTask a = new CheckedRecursiveAction() {
669              protected void realCompute() throws Exception {
670 <                CCF f = new LCCF(null, 8);
670 >                CCF f = new LCCF(8);
671                  assertSame(f, f.fork());
672                  try {
673                      f.get(5L, null);
# Line 602 | Line 683 | public class CountedCompleterTest extend
683      public void testForkQuietlyJoin() {
684          ForkJoinTask a = new CheckedRecursiveAction() {
685              protected void realCompute() {
686 <                CCF f = new LCCF(null, 8);
686 >                CCF f = new LCCF(8);
687                  assertSame(f, f.fork());
688                  f.quietlyJoin();
689                  assertEquals(21, f.number);
# Line 618 | Line 699 | public class CountedCompleterTest extend
699      public void testForkHelpQuiesce() {
700          ForkJoinTask a = new CheckedRecursiveAction() {
701              protected void realCompute() {
702 <                CCF f = new LCCF(null, 8);
702 >                CCF f = new LCCF(8);
703                  assertSame(f, f.fork());
704                  helpQuiesce();
705                  assertEquals(21, f.number);
# Line 634 | Line 715 | public class CountedCompleterTest extend
715      public void testAbnormalInvoke() {
716          ForkJoinTask a = new CheckedRecursiveAction() {
717              protected void realCompute() {
718 <                FailingCCF f = new LFCCF(null, 8);
718 >                FailingCCF f = new LFCCF(8);
719                  try {
720                      f.invoke();
721                      shouldThrow();
# Line 651 | Line 732 | public class CountedCompleterTest extend
732      public void testAbnormalQuietlyInvoke() {
733          ForkJoinTask a = new CheckedRecursiveAction() {
734              protected void realCompute() {
735 <                FailingCCF f = new LFCCF(null, 8);
735 >                FailingCCF f = new LFCCF(8);
736                  f.quietlyInvoke();
737                  assertTrue(f.getException() instanceof FJException);
738                  checkCompletedAbnormally(f, f.getException());
# Line 665 | Line 746 | public class CountedCompleterTest extend
746      public void testAbnormalForkJoin() {
747          ForkJoinTask a = new CheckedRecursiveAction() {
748              protected void realCompute() {
749 <                FailingCCF f = new LFCCF(null, 8);
749 >                FailingCCF f = new LFCCF(8);
750                  assertSame(f, f.fork());
751                  try {
752                      f.join();
# Line 683 | Line 764 | public class CountedCompleterTest extend
764      public void testAbnormalForkGet() {
765          ForkJoinTask a = new CheckedRecursiveAction() {
766              protected void realCompute() throws Exception {
767 <                FailingCCF f = new LFCCF(null, 8);
767 >                FailingCCF f = new LFCCF(8);
768                  assertSame(f, f.fork());
769                  try {
770                      f.get();
# Line 703 | Line 784 | public class CountedCompleterTest extend
784      public void testAbnormalForkTimedGet() {
785          ForkJoinTask a = new CheckedRecursiveAction() {
786              protected void realCompute() throws Exception {
787 <                FailingCCF f = new LFCCF(null, 8);
787 >                FailingCCF f = new LFCCF(8);
788                  assertSame(f, f.fork());
789                  try {
790                      f.get(LONG_DELAY_MS, MILLISECONDS);
# Line 723 | Line 804 | public class CountedCompleterTest extend
804      public void testAbnormalForkQuietlyJoin() {
805          ForkJoinTask a = new CheckedRecursiveAction() {
806              protected void realCompute() {
807 <                FailingCCF f = new LFCCF(null, 8);
807 >                FailingCCF f = new LFCCF(8);
808                  assertSame(f, f.fork());
809                  f.quietlyJoin();
810                  assertTrue(f.getException() instanceof FJException);
# Line 738 | Line 819 | public class CountedCompleterTest extend
819      public void testCancelledInvoke() {
820          ForkJoinTask a = new CheckedRecursiveAction() {
821              protected void realCompute() {
822 <                CCF f = new LCCF(null, 8);
822 >                CCF f = new LCCF(8);
823                  assertTrue(f.cancel(true));
824                  try {
825                      f.invoke();
# Line 756 | Line 837 | public class CountedCompleterTest extend
837      public void testCancelledForkJoin() {
838          ForkJoinTask a = new CheckedRecursiveAction() {
839              protected void realCompute() {
840 <                CCF f = new LCCF(null, 8);
840 >                CCF f = new LCCF(8);
841                  assertTrue(f.cancel(true));
842                  assertSame(f, f.fork());
843                  try {
# Line 775 | Line 856 | public class CountedCompleterTest extend
856      public void testCancelledForkGet() {
857          ForkJoinTask a = new CheckedRecursiveAction() {
858              protected void realCompute() throws Exception {
859 <                CCF f = new LCCF(null, 8);
859 >                CCF f = new LCCF(8);
860                  assertTrue(f.cancel(true));
861                  assertSame(f, f.fork());
862                  try {
# Line 794 | Line 875 | public class CountedCompleterTest extend
875      public void testCancelledForkTimedGet() throws Exception {
876          ForkJoinTask a = new CheckedRecursiveAction() {
877              protected void realCompute() throws Exception {
878 <                CCF f = new LCCF(null, 8);
878 >                CCF f = new LCCF(8);
879                  assertTrue(f.cancel(true));
880                  assertSame(f, f.fork());
881                  try {
# Line 813 | Line 894 | public class CountedCompleterTest extend
894      public void testCancelledForkQuietlyJoin() {
895          ForkJoinTask a = new CheckedRecursiveAction() {
896              protected void realCompute() {
897 <                CCF f = new LCCF(null, 8);
897 >                CCF f = new LCCF(8);
898                  assertTrue(f.cancel(true));
899                  assertSame(f, f.fork());
900                  f.quietlyJoin();
# Line 885 | Line 966 | public class CountedCompleterTest extend
966      public void testCompleteExceptionally2() {
967          ForkJoinTask a = new CheckedRecursiveAction() {
968              protected void realCompute() {
969 <                CCF f = new LCCF(null, 8);
970 <                f.completeExceptionally(new FJException());
971 <                try {
972 <                    f.invoke();
973 <                    shouldThrow();
974 <                } catch (FJException success) {
894 <                    checkCompletedAbnormally(f, success);
895 <                }
969 >                CCF n = new LCCF(8);
970 >                CCF f = new LCCF(n, 8);
971 >                FJException ex = new FJException();
972 >                f.completeExceptionally(ex);
973 >                f.checkCompletedExceptionally(ex);
974 >                n.checkCompletedExceptionally(ex);
975              }};
976          testInvokeOnPool(mainPool(), a);
977      }
# Line 903 | Line 982 | public class CountedCompleterTest extend
982      public void testInvokeAll2() {
983          ForkJoinTask a = new CheckedRecursiveAction() {
984              protected void realCompute() {
985 <                CCF f = new LCCF(null, 8);
986 <                CCF g = new LCCF(null, 9);
985 >                CCF f = new LCCF(8);
986 >                CCF g = new LCCF(9);
987                  invokeAll(f, g);
988                  assertEquals(21, f.number);
989                  assertEquals(34, g.number);
# Line 920 | Line 999 | public class CountedCompleterTest extend
999      public void testInvokeAll1() {
1000          ForkJoinTask a = new CheckedRecursiveAction() {
1001              protected void realCompute() {
1002 <                CCF f = new LCCF(null, 8);
1002 >                CCF f = new LCCF(8);
1003                  invokeAll(f);
1004                  checkCompletedNormally(f);
1005                  assertEquals(21, f.number);
# Line 934 | Line 1013 | public class CountedCompleterTest extend
1013      public void testInvokeAll3() {
1014          ForkJoinTask a = new CheckedRecursiveAction() {
1015              protected void realCompute() {
1016 <                CCF f = new LCCF(null, 8);
1017 <                CCF g = new LCCF(null, 9);
1018 <                CCF h = new LCCF(null, 7);
1016 >                CCF f = new LCCF(8);
1017 >                CCF g = new LCCF(9);
1018 >                CCF h = new LCCF(7);
1019                  invokeAll(f, g, h);
1020                  assertEquals(21, f.number);
1021                  assertEquals(34, g.number);
# Line 954 | Line 1033 | public class CountedCompleterTest extend
1033      public void testInvokeAllCollection() {
1034          ForkJoinTask a = new CheckedRecursiveAction() {
1035              protected void realCompute() {
1036 <                CCF f = new LCCF(null, 8);
1037 <                CCF g = new LCCF(null, 9);
1038 <                CCF h = new LCCF(null, 7);
1036 >                CCF f = new LCCF(8);
1037 >                CCF g = new LCCF(9);
1038 >                CCF h = new LCCF(7);
1039                  HashSet set = new HashSet();
1040                  set.add(f);
1041                  set.add(g);
# Line 978 | Line 1057 | public class CountedCompleterTest extend
1057      public void testInvokeAllNPE() {
1058          ForkJoinTask a = new CheckedRecursiveAction() {
1059              protected void realCompute() {
1060 <                CCF f = new LCCF(null, 8);
1061 <                CCF g = new LCCF(null, 9);
1060 >                CCF f = new LCCF(8);
1061 >                CCF g = new LCCF(9);
1062                  CCF h = null;
1063                  try {
1064                      invokeAll(f, g, h);
# Line 995 | Line 1074 | public class CountedCompleterTest extend
1074      public void testAbnormalInvokeAll2() {
1075          ForkJoinTask a = new CheckedRecursiveAction() {
1076              protected void realCompute() {
1077 <                CCF f = new LCCF(null, 8);
1078 <                FailingCCF g = new LFCCF(null, 9);
1077 >                CCF f = new LCCF(8);
1078 >                FailingCCF g = new LFCCF(9);
1079                  try {
1080                      invokeAll(f, g);
1081                      shouldThrow();
# Line 1013 | Line 1092 | public class CountedCompleterTest extend
1092      public void testAbnormalInvokeAll1() {
1093          ForkJoinTask a = new CheckedRecursiveAction() {
1094              protected void realCompute() {
1095 <                FailingCCF g = new LFCCF(null, 9);
1095 >                FailingCCF g = new LFCCF(9);
1096                  try {
1097                      invokeAll(g);
1098                      shouldThrow();
# Line 1030 | Line 1109 | public class CountedCompleterTest extend
1109      public void testAbnormalInvokeAll3() {
1110          ForkJoinTask a = new CheckedRecursiveAction() {
1111              protected void realCompute() {
1112 <                CCF f = new LCCF(null, 8);
1113 <                FailingCCF g = new LFCCF(null, 9);
1114 <                CCF h = new LCCF(null, 7);
1112 >                CCF f = new LCCF(8);
1113 >                FailingCCF g = new LFCCF(9);
1114 >                CCF h = new LCCF(7);
1115                  try {
1116                      invokeAll(f, g, h);
1117                      shouldThrow();
# Line 1049 | Line 1128 | public class CountedCompleterTest extend
1128      public void testAbnormalInvokeAllCollection() {
1129          ForkJoinTask a = new CheckedRecursiveAction() {
1130              protected void realCompute() {
1131 <                FailingCCF f = new LFCCF(null, 8);
1132 <                CCF g = new LCCF(null, 9);
1133 <                CCF h = new LCCF(null, 7);
1131 >                FailingCCF f = new LFCCF(8);
1132 >                CCF g = new LCCF(9);
1133 >                CCF h = new LCCF(7);
1134                  HashSet set = new HashSet();
1135                  set.add(f);
1136                  set.add(g);
# Line 1073 | Line 1152 | public class CountedCompleterTest extend
1152      public void testTryUnfork() {
1153          ForkJoinTask a = new CheckedRecursiveAction() {
1154              protected void realCompute() {
1155 <                CCF g = new LCCF(null, 9);
1155 >                CCF g = new LCCF(9);
1156                  assertSame(g, g.fork());
1157 <                CCF f = new LCCF(null, 8);
1157 >                CCF f = new LCCF(8);
1158                  assertSame(f, f.fork());
1159                  assertTrue(f.tryUnfork());
1160                  helpQuiesce();
# Line 1092 | Line 1171 | public class CountedCompleterTest extend
1171      public void testGetSurplusQueuedTaskCount() {
1172          ForkJoinTask a = new CheckedRecursiveAction() {
1173              protected void realCompute() {
1174 <                CCF h = new LCCF(null, 7);
1174 >                CCF h = new LCCF(7);
1175                  assertSame(h, h.fork());
1176 <                CCF g = new LCCF(null, 9);
1176 >                CCF g = new LCCF(9);
1177                  assertSame(g, g.fork());
1178 <                CCF f = new LCCF(null, 8);
1178 >                CCF f = new LCCF(8);
1179                  assertSame(f, f.fork());
1180                  assertTrue(getSurplusQueuedTaskCount() > 0);
1181                  helpQuiesce();
# Line 1114 | Line 1193 | public class CountedCompleterTest extend
1193      public void testPeekNextLocalTask() {
1194          ForkJoinTask a = new CheckedRecursiveAction() {
1195              protected void realCompute() {
1196 <                CCF g = new LCCF(null, 9);
1196 >                CCF g = new LCCF(9);
1197                  assertSame(g, g.fork());
1198 <                CCF f = new LCCF(null, 8);
1198 >                CCF f = new LCCF(8);
1199                  assertSame(f, f.fork());
1200                  assertSame(f, peekNextLocalTask());
1201                  assertNull(f.join());
# Line 1134 | Line 1213 | public class CountedCompleterTest extend
1213      public void testPollNextLocalTask() {
1214          ForkJoinTask a = new CheckedRecursiveAction() {
1215              protected void realCompute() {
1216 <                CCF g = new LCCF(null, 9);
1216 >                CCF g = new LCCF(9);
1217                  assertSame(g, g.fork());
1218 <                CCF f = new LCCF(null, 8);
1218 >                CCF f = new LCCF(8);
1219                  assertSame(f, f.fork());
1220                  assertSame(f, pollNextLocalTask());
1221                  helpQuiesce();
# Line 1153 | Line 1232 | public class CountedCompleterTest extend
1232      public void testPollTask() {
1233          ForkJoinTask a = new CheckedRecursiveAction() {
1234              protected void realCompute() {
1235 <                CCF g = new LCCF(null, 9);
1235 >                CCF g = new LCCF(9);
1236                  assertSame(g, g.fork());
1237 <                CCF f = new LCCF(null, 8);
1237 >                CCF f = new LCCF(8);
1238                  assertSame(f, f.fork());
1239                  assertSame(f, pollTask());
1240                  helpQuiesce();
# Line 1171 | Line 1250 | public class CountedCompleterTest extend
1250      public void testPeekNextLocalTaskAsync() {
1251          ForkJoinTask a = new CheckedRecursiveAction() {
1252              protected void realCompute() {
1253 <                CCF g = new LCCF(null, 9);
1253 >                CCF g = new LCCF(9);
1254                  assertSame(g, g.fork());
1255 <                CCF f = new LCCF(null, 8);
1255 >                CCF f = new LCCF(8);
1256                  assertSame(f, f.fork());
1257                  assertSame(g, peekNextLocalTask());
1258                  assertNull(f.join());
# Line 1192 | Line 1271 | public class CountedCompleterTest extend
1271      public void testPollNextLocalTaskAsync() {
1272          ForkJoinTask a = new CheckedRecursiveAction() {
1273              protected void realCompute() {
1274 <                CCF g = new LCCF(null, 9);
1274 >                CCF g = new LCCF(9);
1275                  assertSame(g, g.fork());
1276 <                CCF f = new LCCF(null, 8);
1276 >                CCF f = new LCCF(8);
1277                  assertSame(f, f.fork());
1278                  assertSame(g, pollNextLocalTask());
1279                  helpQuiesce();
# Line 1212 | Line 1291 | public class CountedCompleterTest extend
1291      public void testPollTaskAsync() {
1292          ForkJoinTask a = new CheckedRecursiveAction() {
1293              protected void realCompute() {
1294 <                CCF g = new LCCF(null, 9);
1294 >                CCF g = new LCCF(9);
1295                  assertSame(g, g.fork());
1296 <                CCF f = new LCCF(null, 8);
1296 >                CCF f = new LCCF(8);
1297                  assertSame(f, f.fork());
1298                  assertSame(g, pollTask());
1299                  helpQuiesce();
# Line 1235 | Line 1314 | public class CountedCompleterTest extend
1314      public void testInvokeSingleton() {
1315          ForkJoinTask a = new CheckedRecursiveAction() {
1316              protected void realCompute() {
1317 <                CCF f = new LCCF(null, 8);
1317 >                CCF f = new LCCF(8);
1318                  assertNull(f.invoke());
1319                  assertEquals(21, f.number);
1320                  checkCompletedNormally(f);
# Line 1251 | Line 1330 | public class CountedCompleterTest extend
1330      public void testQuietlyInvokeSingleton() {
1331          ForkJoinTask a = new CheckedRecursiveAction() {
1332              protected void realCompute() {
1333 <                CCF f = new LCCF(null, 8);
1333 >                CCF f = new LCCF(8);
1334                  f.quietlyInvoke();
1335                  assertEquals(21, f.number);
1336                  checkCompletedNormally(f);
# Line 1265 | Line 1344 | public class CountedCompleterTest extend
1344      public void testForkJoinSingleton() {
1345          ForkJoinTask a = new CheckedRecursiveAction() {
1346              protected void realCompute() {
1347 <                CCF f = new LCCF(null, 8);
1347 >                CCF f = new LCCF(8);
1348                  assertSame(f, f.fork());
1349                  assertNull(f.join());
1350                  assertEquals(21, f.number);
# Line 1280 | Line 1359 | public class CountedCompleterTest extend
1359      public void testForkGetSingleton() {
1360          ForkJoinTask a = new CheckedRecursiveAction() {
1361              protected void realCompute() throws Exception {
1362 <                CCF f = new LCCF(null, 8);
1362 >                CCF f = new LCCF(8);
1363                  assertSame(f, f.fork());
1364                  assertNull(f.get());
1365                  assertEquals(21, f.number);
# Line 1295 | Line 1374 | public class CountedCompleterTest extend
1374      public void testForkTimedGetSingleton() {
1375          ForkJoinTask a = new CheckedRecursiveAction() {
1376              protected void realCompute() throws Exception {
1377 <                CCF f = new LCCF(null, 8);
1377 >                CCF f = new LCCF(8);
1378                  assertSame(f, f.fork());
1379                  assertNull(f.get(LONG_DELAY_MS, MILLISECONDS));
1380                  assertEquals(21, f.number);
# Line 1310 | Line 1389 | public class CountedCompleterTest extend
1389      public void testForkTimedGetNPESingleton() {
1390          ForkJoinTask a = new CheckedRecursiveAction() {
1391              protected void realCompute() throws Exception {
1392 <                CCF f = new LCCF(null, 8);
1392 >                CCF f = new LCCF(8);
1393                  assertSame(f, f.fork());
1394                  try {
1395                      f.get(5L, null);
# Line 1326 | Line 1405 | public class CountedCompleterTest extend
1405      public void testForkQuietlyJoinSingleton() {
1406          ForkJoinTask a = new CheckedRecursiveAction() {
1407              protected void realCompute() {
1408 <                CCF f = new LCCF(null, 8);
1408 >                CCF f = new LCCF(8);
1409                  assertSame(f, f.fork());
1410                  f.quietlyJoin();
1411                  assertEquals(21, f.number);
# Line 1342 | Line 1421 | public class CountedCompleterTest extend
1421      public void testForkHelpQuiesceSingleton() {
1422          ForkJoinTask a = new CheckedRecursiveAction() {
1423              protected void realCompute() {
1424 <                CCF f = new LCCF(null, 8);
1424 >                CCF f = new LCCF(8);
1425                  assertSame(f, f.fork());
1426                  helpQuiesce();
1427                  assertEquals(0, getQueuedTaskCount());
# Line 1358 | Line 1437 | public class CountedCompleterTest extend
1437      public void testAbnormalInvokeSingleton() {
1438          ForkJoinTask a = new CheckedRecursiveAction() {
1439              protected void realCompute() {
1440 <                FailingCCF f = new LFCCF(null, 8);
1440 >                FailingCCF f = new LFCCF(8);
1441                  try {
1442                      f.invoke();
1443                      shouldThrow();
# Line 1375 | Line 1454 | public class CountedCompleterTest extend
1454      public void testAbnormalQuietlyInvokeSingleton() {
1455          ForkJoinTask a = new CheckedRecursiveAction() {
1456              protected void realCompute() {
1457 <                FailingCCF f = new LFCCF(null, 8);
1457 >                FailingCCF f = new LFCCF(8);
1458                  f.quietlyInvoke();
1459                  assertTrue(f.getException() instanceof FJException);
1460                  checkCompletedAbnormally(f, f.getException());
# Line 1389 | Line 1468 | public class CountedCompleterTest extend
1468      public void testAbnormalForkJoinSingleton() {
1469          ForkJoinTask a = new CheckedRecursiveAction() {
1470              protected void realCompute() {
1471 <                FailingCCF f = new LFCCF(null, 8);
1471 >                FailingCCF f = new LFCCF(8);
1472                  assertSame(f, f.fork());
1473                  try {
1474                      f.join();
# Line 1407 | Line 1486 | public class CountedCompleterTest extend
1486      public void testAbnormalForkGetSingleton() {
1487          ForkJoinTask a = new CheckedRecursiveAction() {
1488              protected void realCompute() throws Exception {
1489 <                FailingCCF f = new LFCCF(null, 8);
1489 >                FailingCCF f = new LFCCF(8);
1490                  assertSame(f, f.fork());
1491                  try {
1492                      f.get();
# Line 1427 | Line 1506 | public class CountedCompleterTest extend
1506      public void testAbnormalForkTimedGetSingleton() {
1507          ForkJoinTask a = new CheckedRecursiveAction() {
1508              protected void realCompute() throws Exception {
1509 <                FailingCCF f = new LFCCF(null, 8);
1509 >                FailingCCF f = new LFCCF(8);
1510                  assertSame(f, f.fork());
1511                  try {
1512                      f.get(LONG_DELAY_MS, MILLISECONDS);
# Line 1447 | Line 1526 | public class CountedCompleterTest extend
1526      public void testAbnormalForkQuietlyJoinSingleton() {
1527          ForkJoinTask a = new CheckedRecursiveAction() {
1528              protected void realCompute() {
1529 <                FailingCCF f = new LFCCF(null, 8);
1529 >                FailingCCF f = new LFCCF(8);
1530                  assertSame(f, f.fork());
1531                  f.quietlyJoin();
1532                  assertTrue(f.getException() instanceof FJException);
# Line 1462 | Line 1541 | public class CountedCompleterTest extend
1541      public void testCancelledInvokeSingleton() {
1542          ForkJoinTask a = new CheckedRecursiveAction() {
1543              protected void realCompute() {
1544 <                CCF f = new LCCF(null, 8);
1544 >                CCF f = new LCCF(8);
1545                  assertTrue(f.cancel(true));
1546                  try {
1547                      f.invoke();
# Line 1480 | Line 1559 | public class CountedCompleterTest extend
1559      public void testCancelledForkJoinSingleton() {
1560          ForkJoinTask a = new CheckedRecursiveAction() {
1561              protected void realCompute() {
1562 <                CCF f = new LCCF(null, 8);
1562 >                CCF f = new LCCF(8);
1563                  assertTrue(f.cancel(true));
1564                  assertSame(f, f.fork());
1565                  try {
# Line 1499 | Line 1578 | public class CountedCompleterTest extend
1578      public void testCancelledForkGetSingleton() {
1579          ForkJoinTask a = new CheckedRecursiveAction() {
1580              protected void realCompute() throws Exception {
1581 <                CCF f = new LCCF(null, 8);
1581 >                CCF f = new LCCF(8);
1582                  assertTrue(f.cancel(true));
1583                  assertSame(f, f.fork());
1584                  try {
# Line 1518 | Line 1597 | public class CountedCompleterTest extend
1597      public void testCancelledForkTimedGetSingleton() throws Exception {
1598          ForkJoinTask a = new CheckedRecursiveAction() {
1599              protected void realCompute() throws Exception {
1600 <                CCF f = new LCCF(null, 8);
1600 >                CCF f = new LCCF(8);
1601                  assertTrue(f.cancel(true));
1602                  assertSame(f, f.fork());
1603                  try {
# Line 1537 | Line 1616 | public class CountedCompleterTest extend
1616      public void testCancelledForkQuietlyJoinSingleton() {
1617          ForkJoinTask a = new CheckedRecursiveAction() {
1618              protected void realCompute() {
1619 <                CCF f = new LCCF(null, 8);
1619 >                CCF f = new LCCF(8);
1620                  assertTrue(f.cancel(true));
1621                  assertSame(f, f.fork());
1622                  f.quietlyJoin();
# Line 1552 | Line 1631 | public class CountedCompleterTest extend
1631      public void testCompleteExceptionallySingleton() {
1632          ForkJoinTask a = new CheckedRecursiveAction() {
1633              protected void realCompute() {
1634 <                CCF f = new LCCF(null, 8);
1635 <                f.completeExceptionally(new FJException());
1636 <                try {
1637 <                    f.invoke();
1638 <                    shouldThrow();
1639 <                } catch (FJException success) {
1561 <                    checkCompletedAbnormally(f, success);
1562 <                }
1634 >                CCF n = new LCCF(8);
1635 >                CCF f = new LCCF(n, 8);
1636 >                FJException ex = new FJException();
1637 >                f.completeExceptionally(ex);
1638 >                f.checkCompletedExceptionally(ex);
1639 >                n.checkCompletedExceptionally(ex);
1640              }};
1641          testInvokeOnPool(singletonPool(), a);
1642      }
# Line 1570 | Line 1647 | public class CountedCompleterTest extend
1647      public void testInvokeAll2Singleton() {
1648          ForkJoinTask a = new CheckedRecursiveAction() {
1649              protected void realCompute() {
1650 <                CCF f = new LCCF(null, 8);
1651 <                CCF g = new LCCF(null, 9);
1650 >                CCF f = new LCCF(8);
1651 >                CCF g = new LCCF(9);
1652                  invokeAll(f, g);
1653                  assertEquals(21, f.number);
1654                  assertEquals(34, g.number);
# Line 1587 | Line 1664 | public class CountedCompleterTest extend
1664      public void testInvokeAll1Singleton() {
1665          ForkJoinTask a = new CheckedRecursiveAction() {
1666              protected void realCompute() {
1667 <                CCF f = new LCCF(null, 8);
1667 >                CCF f = new LCCF(8);
1668                  invokeAll(f);
1669                  checkCompletedNormally(f);
1670                  assertEquals(21, f.number);
# Line 1601 | Line 1678 | public class CountedCompleterTest extend
1678      public void testInvokeAll3Singleton() {
1679          ForkJoinTask a = new CheckedRecursiveAction() {
1680              protected void realCompute() {
1681 <                CCF f = new LCCF(null, 8);
1682 <                CCF g = new LCCF(null, 9);
1683 <                CCF h = new LCCF(null, 7);
1681 >                CCF f = new LCCF(8);
1682 >                CCF g = new LCCF(9);
1683 >                CCF h = new LCCF(7);
1684                  invokeAll(f, g, h);
1685                  assertEquals(21, f.number);
1686                  assertEquals(34, g.number);
# Line 1621 | Line 1698 | public class CountedCompleterTest extend
1698      public void testInvokeAllCollectionSingleton() {
1699          ForkJoinTask a = new CheckedRecursiveAction() {
1700              protected void realCompute() {
1701 <                CCF f = new LCCF(null, 8);
1702 <                CCF g = new LCCF(null, 9);
1703 <                CCF h = new LCCF(null, 7);
1701 >                CCF f = new LCCF(8);
1702 >                CCF g = new LCCF(9);
1703 >                CCF h = new LCCF(7);
1704                  HashSet set = new HashSet();
1705                  set.add(f);
1706                  set.add(g);
# Line 1645 | Line 1722 | public class CountedCompleterTest extend
1722      public void testInvokeAllNPESingleton() {
1723          ForkJoinTask a = new CheckedRecursiveAction() {
1724              protected void realCompute() {
1725 <                CCF f = new LCCF(null, 8);
1726 <                CCF g = new LCCF(null, 9);
1725 >                CCF f = new LCCF(8);
1726 >                CCF g = new LCCF(9);
1727                  CCF h = null;
1728                  try {
1729                      invokeAll(f, g, h);
# Line 1662 | Line 1739 | public class CountedCompleterTest extend
1739      public void testAbnormalInvokeAll2Singleton() {
1740          ForkJoinTask a = new CheckedRecursiveAction() {
1741              protected void realCompute() {
1742 <                CCF f = new LCCF(null, 8);
1743 <                FailingCCF g = new LFCCF(null, 9);
1742 >                CCF f = new LCCF(8);
1743 >                FailingCCF g = new LFCCF(9);
1744                  try {
1745                      invokeAll(f, g);
1746                      shouldThrow();
# Line 1680 | Line 1757 | public class CountedCompleterTest extend
1757      public void testAbnormalInvokeAll1Singleton() {
1758          ForkJoinTask a = new CheckedRecursiveAction() {
1759              protected void realCompute() {
1760 <                FailingCCF g = new LFCCF(null, 9);
1760 >                FailingCCF g = new LFCCF(9);
1761                  try {
1762                      invokeAll(g);
1763                      shouldThrow();
# Line 1697 | Line 1774 | public class CountedCompleterTest extend
1774      public void testAbnormalInvokeAll3Singleton() {
1775          ForkJoinTask a = new CheckedRecursiveAction() {
1776              protected void realCompute() {
1777 <                CCF f = new LCCF(null, 8);
1778 <                FailingCCF g = new LFCCF(null, 9);
1779 <                CCF h = new LCCF(null, 7);
1777 >                CCF f = new LCCF(8);
1778 >                FailingCCF g = new LFCCF(9);
1779 >                CCF h = new LCCF(7);
1780                  try {
1781                      invokeAll(f, g, h);
1782                      shouldThrow();
# Line 1716 | Line 1793 | public class CountedCompleterTest extend
1793      public void testAbnormalInvokeAllCollectionSingleton() {
1794          ForkJoinTask a = new CheckedRecursiveAction() {
1795              protected void realCompute() {
1796 <                FailingCCF f = new LFCCF(null, 8);
1797 <                CCF g = new LCCF(null, 9);
1798 <                CCF h = new LCCF(null, 7);
1796 >                FailingCCF f = new LFCCF(8);
1797 >                CCF g = new LCCF(9);
1798 >                CCF h = new LCCF(7);
1799                  HashSet set = new HashSet();
1800                  set.add(f);
1801                  set.add(g);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines