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.9 by jsr166, Wed Jun 5 05:48:26 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());
449 >        a.checkIncomplete();
450 >        assertSame(a, a.firstComplete());
451 >        a.checkIncomplete();
452      }
453  
454      /**
# Line 370 | Line 456 | public class CountedCompleterTest extend
456       * zero else null
457       */
458      public void testNextComplete() {
459 <        NoopCountedCompleter a = new NoopCountedCompleter();
460 <        NoopCountedCompleter b = new NoopCountedCompleter(a);
459 >        NoopCC a = new NoopCC();
460 >        NoopCC b = new NoopCC(a);
461          a.setPendingCount(1);
462          b.setPendingCount(1);
463          assertNull(b.firstComplete());
464 <        CountedCompleter c = b.firstComplete();
465 <        assertEquals(b, c);
466 <        CountedCompleter d = c.nextComplete();
467 <        assertNull(d);
468 <        CountedCompleter e = c.nextComplete();
469 <        assertEquals(a, e);
464 >        assertSame(b, b.firstComplete());
465 >        assertNull(b.nextComplete());
466 >        a.checkIncomplete();
467 >        b.checkIncomplete();
468 >        assertSame(a, b.nextComplete());
469 >        assertSame(a, b.nextComplete());
470 >        a.checkIncomplete();
471 >        b.checkIncomplete();
472 >        assertNull(a.nextComplete());
473 >        b.checkIncomplete();
474 >        checkCompletedNormally(a);
475      }
476  
477      /**
478       * quietlyCompleteRoot completes root task
479       */
480      public void testQuietlyCompleteRoot() {
481 <        NoopCountedCompleter a = new NoopCountedCompleter();
482 <        NoopCountedCompleter b = new NoopCountedCompleter(a);
481 >        NoopCC a = new NoopCC();
482 >        NoopCC b = new NoopCC(a);
483 >        NoopCC c = new NoopCC(b);
484          a.setPendingCount(1);
485          b.setPendingCount(1);
486 <        b.quietlyCompleteRoot();
486 >        c.setPendingCount(1);
487 >        c.quietlyCompleteRoot();
488          assertTrue(a.isDone());
489          assertFalse(b.isDone());
490 +        assertFalse(c.isDone());
491      }
492  
493      // Invocation tests use some interdependent task classes
# Line 401 | Line 495 | public class CountedCompleterTest extend
495  
496  
497      // Version of Fibonacci with different classes for left vs right forks
498 <    abstract static class CCF extends CountedCompleter {
498 >    abstract class CCF extends CheckedCC {
499          int number;
500          int rnumber;
501  
# Line 410 | Line 504 | public class CountedCompleterTest extend
504              this.number = n;
505          }
506  
507 <        public final void compute() {
414 <            CountedCompleter p;
507 >        protected final void realCompute() {
508              CCF f = this;
509              int n = number;
510              while (n >= 2) {
511                  new RCCF(f, n - 2).fork();
512                  f = new LCCF(f, --n);
513              }
514 <            f.number = n;
422 <            f.onCompletion(f);
423 <            if ((p = f.getCompleter()) != null)
424 <                p.tryComplete();
425 <            else
426 <                f.quietlyComplete();
514 >            f.complete(null);
515          }
516      }
517  
518 <    static final class LCCF extends CCF {
518 >    final class LCCF extends CCF {
519 >        public LCCF(int n) { this(null, n); }
520          public LCCF(CountedCompleter parent, int n) {
521              super(parent, n);
522          }
523          public final void onCompletion(CountedCompleter caller) {
524 +            super.onCompletion(caller);
525              CCF p = (CCF)getCompleter();
526              int n = number + rnumber;
527              if (p != null)
# Line 440 | Line 530 | public class CountedCompleterTest extend
530                  number = n;
531          }
532      }
533 <    static final class RCCF extends CCF {
533 >    final class RCCF extends CCF {
534          public RCCF(CountedCompleter parent, int n) {
535              super(parent, n);
536          }
537          public final void onCompletion(CountedCompleter caller) {
538 +            super.onCompletion(caller);
539              CCF p = (CCF)getCompleter();
540              int n = number + rnumber;
541              if (p != null)
# Line 455 | Line 546 | public class CountedCompleterTest extend
546      }
547  
548      // Version of CCF with forced failure in left completions
549 <    abstract static class FailingCCF extends CountedCompleter {
549 >    abstract class FailingCCF extends CheckedCC {
550          int number;
551          int rnumber;
552  
# Line 464 | Line 555 | public class CountedCompleterTest extend
555              this.number = n;
556          }
557  
558 <        public final void compute() {
468 <            CountedCompleter p;
558 >        protected final void realCompute() {
559              FailingCCF f = this;
560              int n = number;
561              while (n >= 2) {
562                  new RFCCF(f, n - 2).fork();
563                  f = new LFCCF(f, --n);
564              }
565 <            f.number = n;
476 <            f.onCompletion(f);
477 <            if ((p = f.getCompleter()) != null)
478 <                p.tryComplete();
479 <            else
480 <                f.quietlyComplete();
565 >            f.complete(null);
566          }
567      }
568  
569 <    static final class LFCCF extends FailingCCF {
569 >    final class LFCCF extends FailingCCF {
570 >        public LFCCF(int n) { this(null, n); }
571          public LFCCF(CountedCompleter parent, int n) {
572              super(parent, n);
573          }
574          public final void onCompletion(CountedCompleter caller) {
575 +            super.onCompletion(caller);
576              FailingCCF p = (FailingCCF)getCompleter();
577              int n = number + rnumber;
578              if (p != null)
# Line 494 | Line 581 | public class CountedCompleterTest extend
581                  number = n;
582          }
583      }
584 <    static final class RFCCF extends FailingCCF {
584 >    final class RFCCF extends FailingCCF {
585          public RFCCF(CountedCompleter parent, int n) {
586              super(parent, n);
587          }
588          public final void onCompletion(CountedCompleter caller) {
589 +            super.onCompletion(caller);
590              completeExceptionally(new FJException());
591          }
592      }
# Line 511 | Line 599 | public class CountedCompleterTest extend
599      public void testInvoke() {
600          ForkJoinTask a = new CheckedRecursiveAction() {
601              protected void realCompute() {
602 <                CCF f = new LCCF(null, 8);
602 >                CCF f = new LCCF(8);
603                  assertNull(f.invoke());
604                  assertEquals(21, f.number);
605                  checkCompletedNormally(f);
# Line 527 | Line 615 | public class CountedCompleterTest extend
615      public void testQuietlyInvoke() {
616          ForkJoinTask a = new CheckedRecursiveAction() {
617              protected void realCompute() {
618 <                CCF f = new LCCF(null, 8);
618 >                CCF f = new LCCF(8);
619                  f.quietlyInvoke();
620                  assertEquals(21, f.number);
621                  checkCompletedNormally(f);
# Line 541 | Line 629 | public class CountedCompleterTest extend
629      public void testForkJoin() {
630          ForkJoinTask a = new CheckedRecursiveAction() {
631              protected void realCompute() {
632 <                CCF f = new LCCF(null, 8);
632 >                CCF f = new LCCF(8);
633                  assertSame(f, f.fork());
634                  assertNull(f.join());
635                  assertEquals(21, f.number);
# Line 556 | Line 644 | public class CountedCompleterTest extend
644      public void testForkGet() {
645          ForkJoinTask a = new CheckedRecursiveAction() {
646              protected void realCompute() throws Exception {
647 <                CCF f = new LCCF(null, 8);
647 >                CCF f = new LCCF(8);
648                  assertSame(f, f.fork());
649                  assertNull(f.get());
650                  assertEquals(21, f.number);
# Line 571 | Line 659 | public class CountedCompleterTest extend
659      public void testForkTimedGet() {
660          ForkJoinTask a = new CheckedRecursiveAction() {
661              protected void realCompute() throws Exception {
662 <                CCF f = new LCCF(null, 8);
662 >                CCF f = new LCCF(8);
663                  assertSame(f, f.fork());
664                  assertNull(f.get(LONG_DELAY_MS, MILLISECONDS));
665                  assertEquals(21, f.number);
# Line 586 | Line 674 | public class CountedCompleterTest extend
674      public void testForkTimedGetNPE() {
675          ForkJoinTask a = new CheckedRecursiveAction() {
676              protected void realCompute() throws Exception {
677 <                CCF f = new LCCF(null, 8);
677 >                CCF f = new LCCF(8);
678                  assertSame(f, f.fork());
679                  try {
680                      f.get(5L, null);
# Line 602 | Line 690 | public class CountedCompleterTest extend
690      public void testForkQuietlyJoin() {
691          ForkJoinTask a = new CheckedRecursiveAction() {
692              protected void realCompute() {
693 <                CCF f = new LCCF(null, 8);
693 >                CCF f = new LCCF(8);
694                  assertSame(f, f.fork());
695                  f.quietlyJoin();
696                  assertEquals(21, f.number);
# Line 618 | Line 706 | public class CountedCompleterTest extend
706      public void testForkHelpQuiesce() {
707          ForkJoinTask a = new CheckedRecursiveAction() {
708              protected void realCompute() {
709 <                CCF f = new LCCF(null, 8);
709 >                CCF f = new LCCF(8);
710                  assertSame(f, f.fork());
711                  helpQuiesce();
712                  assertEquals(21, f.number);
# Line 634 | Line 722 | public class CountedCompleterTest extend
722      public void testAbnormalInvoke() {
723          ForkJoinTask a = new CheckedRecursiveAction() {
724              protected void realCompute() {
725 <                FailingCCF f = new LFCCF(null, 8);
725 >                FailingCCF f = new LFCCF(8);
726                  try {
727                      f.invoke();
728                      shouldThrow();
# Line 651 | Line 739 | public class CountedCompleterTest extend
739      public void testAbnormalQuietlyInvoke() {
740          ForkJoinTask a = new CheckedRecursiveAction() {
741              protected void realCompute() {
742 <                FailingCCF f = new LFCCF(null, 8);
742 >                FailingCCF f = new LFCCF(8);
743                  f.quietlyInvoke();
744                  assertTrue(f.getException() instanceof FJException);
745                  checkCompletedAbnormally(f, f.getException());
# Line 665 | Line 753 | public class CountedCompleterTest extend
753      public void testAbnormalForkJoin() {
754          ForkJoinTask a = new CheckedRecursiveAction() {
755              protected void realCompute() {
756 <                FailingCCF f = new LFCCF(null, 8);
756 >                FailingCCF f = new LFCCF(8);
757                  assertSame(f, f.fork());
758                  try {
759                      f.join();
# Line 683 | Line 771 | public class CountedCompleterTest extend
771      public void testAbnormalForkGet() {
772          ForkJoinTask a = new CheckedRecursiveAction() {
773              protected void realCompute() throws Exception {
774 <                FailingCCF f = new LFCCF(null, 8);
774 >                FailingCCF f = new LFCCF(8);
775                  assertSame(f, f.fork());
776                  try {
777                      f.get();
# Line 703 | Line 791 | public class CountedCompleterTest extend
791      public void testAbnormalForkTimedGet() {
792          ForkJoinTask a = new CheckedRecursiveAction() {
793              protected void realCompute() throws Exception {
794 <                FailingCCF f = new LFCCF(null, 8);
794 >                FailingCCF f = new LFCCF(8);
795                  assertSame(f, f.fork());
796                  try {
797                      f.get(LONG_DELAY_MS, MILLISECONDS);
# Line 723 | Line 811 | public class CountedCompleterTest extend
811      public void testAbnormalForkQuietlyJoin() {
812          ForkJoinTask a = new CheckedRecursiveAction() {
813              protected void realCompute() {
814 <                FailingCCF f = new LFCCF(null, 8);
814 >                FailingCCF f = new LFCCF(8);
815                  assertSame(f, f.fork());
816                  f.quietlyJoin();
817                  assertTrue(f.getException() instanceof FJException);
# Line 738 | Line 826 | public class CountedCompleterTest extend
826      public void testCancelledInvoke() {
827          ForkJoinTask a = new CheckedRecursiveAction() {
828              protected void realCompute() {
829 <                CCF f = new LCCF(null, 8);
829 >                CCF f = new LCCF(8);
830                  assertTrue(f.cancel(true));
831                  try {
832                      f.invoke();
# Line 756 | Line 844 | public class CountedCompleterTest extend
844      public void testCancelledForkJoin() {
845          ForkJoinTask a = new CheckedRecursiveAction() {
846              protected void realCompute() {
847 <                CCF f = new LCCF(null, 8);
847 >                CCF f = new LCCF(8);
848                  assertTrue(f.cancel(true));
849                  assertSame(f, f.fork());
850                  try {
# Line 775 | Line 863 | public class CountedCompleterTest extend
863      public void testCancelledForkGet() {
864          ForkJoinTask a = new CheckedRecursiveAction() {
865              protected void realCompute() throws Exception {
866 <                CCF f = new LCCF(null, 8);
866 >                CCF f = new LCCF(8);
867                  assertTrue(f.cancel(true));
868                  assertSame(f, f.fork());
869                  try {
# Line 794 | Line 882 | public class CountedCompleterTest extend
882      public void testCancelledForkTimedGet() throws Exception {
883          ForkJoinTask a = new CheckedRecursiveAction() {
884              protected void realCompute() throws Exception {
885 <                CCF f = new LCCF(null, 8);
885 >                CCF f = new LCCF(8);
886                  assertTrue(f.cancel(true));
887                  assertSame(f, f.fork());
888                  try {
# Line 813 | Line 901 | public class CountedCompleterTest extend
901      public void testCancelledForkQuietlyJoin() {
902          ForkJoinTask a = new CheckedRecursiveAction() {
903              protected void realCompute() {
904 <                CCF f = new LCCF(null, 8);
904 >                CCF f = new LCCF(8);
905                  assertTrue(f.cancel(true));
906                  assertSame(f, f.fork());
907                  f.quietlyJoin();
# Line 885 | Line 973 | public class CountedCompleterTest extend
973      public void testCompleteExceptionally2() {
974          ForkJoinTask a = new CheckedRecursiveAction() {
975              protected void realCompute() {
976 <                CCF f = new LCCF(null, 8);
977 <                f.completeExceptionally(new FJException());
978 <                try {
979 <                    f.invoke();
980 <                    shouldThrow();
981 <                } catch (FJException success) {
894 <                    checkCompletedAbnormally(f, success);
895 <                }
976 >                CCF n = new LCCF(8);
977 >                CCF f = new LCCF(n, 8);
978 >                FJException ex = new FJException();
979 >                f.completeExceptionally(ex);
980 >                f.checkCompletedExceptionally(ex);
981 >                n.checkCompletedExceptionally(ex);
982              }};
983          testInvokeOnPool(mainPool(), a);
984      }
# Line 903 | Line 989 | public class CountedCompleterTest extend
989      public void testInvokeAll2() {
990          ForkJoinTask a = new CheckedRecursiveAction() {
991              protected void realCompute() {
992 <                CCF f = new LCCF(null, 8);
993 <                CCF g = new LCCF(null, 9);
992 >                CCF f = new LCCF(8);
993 >                CCF g = new LCCF(9);
994                  invokeAll(f, g);
995                  assertEquals(21, f.number);
996                  assertEquals(34, g.number);
# Line 920 | Line 1006 | public class CountedCompleterTest extend
1006      public void testInvokeAll1() {
1007          ForkJoinTask a = new CheckedRecursiveAction() {
1008              protected void realCompute() {
1009 <                CCF f = new LCCF(null, 8);
1009 >                CCF f = new LCCF(8);
1010                  invokeAll(f);
1011                  checkCompletedNormally(f);
1012                  assertEquals(21, f.number);
# Line 934 | Line 1020 | public class CountedCompleterTest extend
1020      public void testInvokeAll3() {
1021          ForkJoinTask a = new CheckedRecursiveAction() {
1022              protected void realCompute() {
1023 <                CCF f = new LCCF(null, 8);
1024 <                CCF g = new LCCF(null, 9);
1025 <                CCF h = new LCCF(null, 7);
1023 >                CCF f = new LCCF(8);
1024 >                CCF g = new LCCF(9);
1025 >                CCF h = new LCCF(7);
1026                  invokeAll(f, g, h);
1027                  assertEquals(21, f.number);
1028                  assertEquals(34, g.number);
# Line 954 | Line 1040 | public class CountedCompleterTest extend
1040      public void testInvokeAllCollection() {
1041          ForkJoinTask a = new CheckedRecursiveAction() {
1042              protected void realCompute() {
1043 <                CCF f = new LCCF(null, 8);
1044 <                CCF g = new LCCF(null, 9);
1045 <                CCF h = new LCCF(null, 7);
1043 >                CCF f = new LCCF(8);
1044 >                CCF g = new LCCF(9);
1045 >                CCF h = new LCCF(7);
1046                  HashSet set = new HashSet();
1047                  set.add(f);
1048                  set.add(g);
# Line 978 | Line 1064 | public class CountedCompleterTest extend
1064      public void testInvokeAllNPE() {
1065          ForkJoinTask a = new CheckedRecursiveAction() {
1066              protected void realCompute() {
1067 <                CCF f = new LCCF(null, 8);
1068 <                CCF g = new LCCF(null, 9);
1067 >                CCF f = new LCCF(8);
1068 >                CCF g = new LCCF(9);
1069                  CCF h = null;
1070                  try {
1071                      invokeAll(f, g, h);
# Line 995 | Line 1081 | public class CountedCompleterTest extend
1081      public void testAbnormalInvokeAll2() {
1082          ForkJoinTask a = new CheckedRecursiveAction() {
1083              protected void realCompute() {
1084 <                CCF f = new LCCF(null, 8);
1085 <                FailingCCF g = new LFCCF(null, 9);
1084 >                CCF f = new LCCF(8);
1085 >                FailingCCF g = new LFCCF(9);
1086                  try {
1087                      invokeAll(f, g);
1088                      shouldThrow();
# Line 1013 | Line 1099 | public class CountedCompleterTest extend
1099      public void testAbnormalInvokeAll1() {
1100          ForkJoinTask a = new CheckedRecursiveAction() {
1101              protected void realCompute() {
1102 <                FailingCCF g = new LFCCF(null, 9);
1102 >                FailingCCF g = new LFCCF(9);
1103                  try {
1104                      invokeAll(g);
1105                      shouldThrow();
# Line 1030 | Line 1116 | public class CountedCompleterTest extend
1116      public void testAbnormalInvokeAll3() {
1117          ForkJoinTask a = new CheckedRecursiveAction() {
1118              protected void realCompute() {
1119 <                CCF f = new LCCF(null, 8);
1120 <                FailingCCF g = new LFCCF(null, 9);
1121 <                CCF h = new LCCF(null, 7);
1119 >                CCF f = new LCCF(8);
1120 >                FailingCCF g = new LFCCF(9);
1121 >                CCF h = new LCCF(7);
1122                  try {
1123                      invokeAll(f, g, h);
1124                      shouldThrow();
# Line 1049 | Line 1135 | public class CountedCompleterTest extend
1135      public void testAbnormalInvokeAllCollection() {
1136          ForkJoinTask a = new CheckedRecursiveAction() {
1137              protected void realCompute() {
1138 <                FailingCCF f = new LFCCF(null, 8);
1139 <                CCF g = new LCCF(null, 9);
1140 <                CCF h = new LCCF(null, 7);
1138 >                FailingCCF f = new LFCCF(8);
1139 >                CCF g = new LCCF(9);
1140 >                CCF h = new LCCF(7);
1141                  HashSet set = new HashSet();
1142                  set.add(f);
1143                  set.add(g);
# Line 1073 | Line 1159 | public class CountedCompleterTest extend
1159      public void testTryUnfork() {
1160          ForkJoinTask a = new CheckedRecursiveAction() {
1161              protected void realCompute() {
1162 <                CCF g = new LCCF(null, 9);
1162 >                CCF g = new LCCF(9);
1163                  assertSame(g, g.fork());
1164 <                CCF f = new LCCF(null, 8);
1164 >                CCF f = new LCCF(8);
1165                  assertSame(f, f.fork());
1166                  assertTrue(f.tryUnfork());
1167                  helpQuiesce();
# Line 1092 | Line 1178 | public class CountedCompleterTest extend
1178      public void testGetSurplusQueuedTaskCount() {
1179          ForkJoinTask a = new CheckedRecursiveAction() {
1180              protected void realCompute() {
1181 <                CCF h = new LCCF(null, 7);
1181 >                CCF h = new LCCF(7);
1182                  assertSame(h, h.fork());
1183 <                CCF g = new LCCF(null, 9);
1183 >                CCF g = new LCCF(9);
1184                  assertSame(g, g.fork());
1185 <                CCF f = new LCCF(null, 8);
1185 >                CCF f = new LCCF(8);
1186                  assertSame(f, f.fork());
1187                  assertTrue(getSurplusQueuedTaskCount() > 0);
1188                  helpQuiesce();
# Line 1114 | Line 1200 | public class CountedCompleterTest extend
1200      public void testPeekNextLocalTask() {
1201          ForkJoinTask a = new CheckedRecursiveAction() {
1202              protected void realCompute() {
1203 <                CCF g = new LCCF(null, 9);
1203 >                CCF g = new LCCF(9);
1204                  assertSame(g, g.fork());
1205 <                CCF f = new LCCF(null, 8);
1205 >                CCF f = new LCCF(8);
1206                  assertSame(f, f.fork());
1207                  assertSame(f, peekNextLocalTask());
1208                  assertNull(f.join());
# Line 1134 | Line 1220 | public class CountedCompleterTest extend
1220      public void testPollNextLocalTask() {
1221          ForkJoinTask a = new CheckedRecursiveAction() {
1222              protected void realCompute() {
1223 <                CCF g = new LCCF(null, 9);
1223 >                CCF g = new LCCF(9);
1224                  assertSame(g, g.fork());
1225 <                CCF f = new LCCF(null, 8);
1225 >                CCF f = new LCCF(8);
1226                  assertSame(f, f.fork());
1227                  assertSame(f, pollNextLocalTask());
1228                  helpQuiesce();
# Line 1153 | Line 1239 | public class CountedCompleterTest extend
1239      public void testPollTask() {
1240          ForkJoinTask a = new CheckedRecursiveAction() {
1241              protected void realCompute() {
1242 <                CCF g = new LCCF(null, 9);
1242 >                CCF g = new LCCF(9);
1243                  assertSame(g, g.fork());
1244 <                CCF f = new LCCF(null, 8);
1244 >                CCF f = new LCCF(8);
1245                  assertSame(f, f.fork());
1246                  assertSame(f, pollTask());
1247                  helpQuiesce();
# Line 1171 | Line 1257 | public class CountedCompleterTest extend
1257      public void testPeekNextLocalTaskAsync() {
1258          ForkJoinTask a = new CheckedRecursiveAction() {
1259              protected void realCompute() {
1260 <                CCF g = new LCCF(null, 9);
1260 >                CCF g = new LCCF(9);
1261                  assertSame(g, g.fork());
1262 <                CCF f = new LCCF(null, 8);
1262 >                CCF f = new LCCF(8);
1263                  assertSame(f, f.fork());
1264                  assertSame(g, peekNextLocalTask());
1265                  assertNull(f.join());
# Line 1192 | Line 1278 | public class CountedCompleterTest extend
1278      public void testPollNextLocalTaskAsync() {
1279          ForkJoinTask a = new CheckedRecursiveAction() {
1280              protected void realCompute() {
1281 <                CCF g = new LCCF(null, 9);
1281 >                CCF g = new LCCF(9);
1282                  assertSame(g, g.fork());
1283 <                CCF f = new LCCF(null, 8);
1283 >                CCF f = new LCCF(8);
1284                  assertSame(f, f.fork());
1285                  assertSame(g, pollNextLocalTask());
1286                  helpQuiesce();
# Line 1212 | Line 1298 | public class CountedCompleterTest extend
1298      public void testPollTaskAsync() {
1299          ForkJoinTask a = new CheckedRecursiveAction() {
1300              protected void realCompute() {
1301 <                CCF g = new LCCF(null, 9);
1301 >                CCF g = new LCCF(9);
1302                  assertSame(g, g.fork());
1303 <                CCF f = new LCCF(null, 8);
1303 >                CCF f = new LCCF(8);
1304                  assertSame(f, f.fork());
1305                  assertSame(g, pollTask());
1306                  helpQuiesce();
# Line 1235 | Line 1321 | public class CountedCompleterTest extend
1321      public void testInvokeSingleton() {
1322          ForkJoinTask a = new CheckedRecursiveAction() {
1323              protected void realCompute() {
1324 <                CCF f = new LCCF(null, 8);
1324 >                CCF f = new LCCF(8);
1325                  assertNull(f.invoke());
1326                  assertEquals(21, f.number);
1327                  checkCompletedNormally(f);
# Line 1251 | Line 1337 | public class CountedCompleterTest extend
1337      public void testQuietlyInvokeSingleton() {
1338          ForkJoinTask a = new CheckedRecursiveAction() {
1339              protected void realCompute() {
1340 <                CCF f = new LCCF(null, 8);
1340 >                CCF f = new LCCF(8);
1341                  f.quietlyInvoke();
1342                  assertEquals(21, f.number);
1343                  checkCompletedNormally(f);
# Line 1265 | Line 1351 | public class CountedCompleterTest extend
1351      public void testForkJoinSingleton() {
1352          ForkJoinTask a = new CheckedRecursiveAction() {
1353              protected void realCompute() {
1354 <                CCF f = new LCCF(null, 8);
1354 >                CCF f = new LCCF(8);
1355                  assertSame(f, f.fork());
1356                  assertNull(f.join());
1357                  assertEquals(21, f.number);
# Line 1280 | Line 1366 | public class CountedCompleterTest extend
1366      public void testForkGetSingleton() {
1367          ForkJoinTask a = new CheckedRecursiveAction() {
1368              protected void realCompute() throws Exception {
1369 <                CCF f = new LCCF(null, 8);
1369 >                CCF f = new LCCF(8);
1370                  assertSame(f, f.fork());
1371                  assertNull(f.get());
1372                  assertEquals(21, f.number);
# Line 1295 | Line 1381 | public class CountedCompleterTest extend
1381      public void testForkTimedGetSingleton() {
1382          ForkJoinTask a = new CheckedRecursiveAction() {
1383              protected void realCompute() throws Exception {
1384 <                CCF f = new LCCF(null, 8);
1384 >                CCF f = new LCCF(8);
1385                  assertSame(f, f.fork());
1386                  assertNull(f.get(LONG_DELAY_MS, MILLISECONDS));
1387                  assertEquals(21, f.number);
# Line 1310 | Line 1396 | public class CountedCompleterTest extend
1396      public void testForkTimedGetNPESingleton() {
1397          ForkJoinTask a = new CheckedRecursiveAction() {
1398              protected void realCompute() throws Exception {
1399 <                CCF f = new LCCF(null, 8);
1399 >                CCF f = new LCCF(8);
1400                  assertSame(f, f.fork());
1401                  try {
1402                      f.get(5L, null);
# Line 1326 | Line 1412 | public class CountedCompleterTest extend
1412      public void testForkQuietlyJoinSingleton() {
1413          ForkJoinTask a = new CheckedRecursiveAction() {
1414              protected void realCompute() {
1415 <                CCF f = new LCCF(null, 8);
1415 >                CCF f = new LCCF(8);
1416                  assertSame(f, f.fork());
1417                  f.quietlyJoin();
1418                  assertEquals(21, f.number);
# Line 1342 | Line 1428 | public class CountedCompleterTest extend
1428      public void testForkHelpQuiesceSingleton() {
1429          ForkJoinTask a = new CheckedRecursiveAction() {
1430              protected void realCompute() {
1431 <                CCF f = new LCCF(null, 8);
1431 >                CCF f = new LCCF(8);
1432                  assertSame(f, f.fork());
1433                  helpQuiesce();
1434                  assertEquals(0, getQueuedTaskCount());
# Line 1358 | Line 1444 | public class CountedCompleterTest extend
1444      public void testAbnormalInvokeSingleton() {
1445          ForkJoinTask a = new CheckedRecursiveAction() {
1446              protected void realCompute() {
1447 <                FailingCCF f = new LFCCF(null, 8);
1447 >                FailingCCF f = new LFCCF(8);
1448                  try {
1449                      f.invoke();
1450                      shouldThrow();
# Line 1375 | Line 1461 | public class CountedCompleterTest extend
1461      public void testAbnormalQuietlyInvokeSingleton() {
1462          ForkJoinTask a = new CheckedRecursiveAction() {
1463              protected void realCompute() {
1464 <                FailingCCF f = new LFCCF(null, 8);
1464 >                FailingCCF f = new LFCCF(8);
1465                  f.quietlyInvoke();
1466                  assertTrue(f.getException() instanceof FJException);
1467                  checkCompletedAbnormally(f, f.getException());
# Line 1389 | Line 1475 | public class CountedCompleterTest extend
1475      public void testAbnormalForkJoinSingleton() {
1476          ForkJoinTask a = new CheckedRecursiveAction() {
1477              protected void realCompute() {
1478 <                FailingCCF f = new LFCCF(null, 8);
1478 >                FailingCCF f = new LFCCF(8);
1479                  assertSame(f, f.fork());
1480                  try {
1481                      f.join();
# Line 1407 | Line 1493 | public class CountedCompleterTest extend
1493      public void testAbnormalForkGetSingleton() {
1494          ForkJoinTask a = new CheckedRecursiveAction() {
1495              protected void realCompute() throws Exception {
1496 <                FailingCCF f = new LFCCF(null, 8);
1496 >                FailingCCF f = new LFCCF(8);
1497                  assertSame(f, f.fork());
1498                  try {
1499                      f.get();
# Line 1427 | Line 1513 | public class CountedCompleterTest extend
1513      public void testAbnormalForkTimedGetSingleton() {
1514          ForkJoinTask a = new CheckedRecursiveAction() {
1515              protected void realCompute() throws Exception {
1516 <                FailingCCF f = new LFCCF(null, 8);
1516 >                FailingCCF f = new LFCCF(8);
1517                  assertSame(f, f.fork());
1518                  try {
1519                      f.get(LONG_DELAY_MS, MILLISECONDS);
# Line 1447 | Line 1533 | public class CountedCompleterTest extend
1533      public void testAbnormalForkQuietlyJoinSingleton() {
1534          ForkJoinTask a = new CheckedRecursiveAction() {
1535              protected void realCompute() {
1536 <                FailingCCF f = new LFCCF(null, 8);
1536 >                FailingCCF f = new LFCCF(8);
1537                  assertSame(f, f.fork());
1538                  f.quietlyJoin();
1539                  assertTrue(f.getException() instanceof FJException);
# Line 1462 | Line 1548 | public class CountedCompleterTest extend
1548      public void testCancelledInvokeSingleton() {
1549          ForkJoinTask a = new CheckedRecursiveAction() {
1550              protected void realCompute() {
1551 <                CCF f = new LCCF(null, 8);
1551 >                CCF f = new LCCF(8);
1552                  assertTrue(f.cancel(true));
1553                  try {
1554                      f.invoke();
# Line 1480 | Line 1566 | public class CountedCompleterTest extend
1566      public void testCancelledForkJoinSingleton() {
1567          ForkJoinTask a = new CheckedRecursiveAction() {
1568              protected void realCompute() {
1569 <                CCF f = new LCCF(null, 8);
1569 >                CCF f = new LCCF(8);
1570                  assertTrue(f.cancel(true));
1571                  assertSame(f, f.fork());
1572                  try {
# Line 1499 | Line 1585 | public class CountedCompleterTest extend
1585      public void testCancelledForkGetSingleton() {
1586          ForkJoinTask a = new CheckedRecursiveAction() {
1587              protected void realCompute() throws Exception {
1588 <                CCF f = new LCCF(null, 8);
1588 >                CCF f = new LCCF(8);
1589                  assertTrue(f.cancel(true));
1590                  assertSame(f, f.fork());
1591                  try {
# Line 1518 | Line 1604 | public class CountedCompleterTest extend
1604      public void testCancelledForkTimedGetSingleton() throws Exception {
1605          ForkJoinTask a = new CheckedRecursiveAction() {
1606              protected void realCompute() throws Exception {
1607 <                CCF f = new LCCF(null, 8);
1607 >                CCF f = new LCCF(8);
1608                  assertTrue(f.cancel(true));
1609                  assertSame(f, f.fork());
1610                  try {
# Line 1537 | Line 1623 | public class CountedCompleterTest extend
1623      public void testCancelledForkQuietlyJoinSingleton() {
1624          ForkJoinTask a = new CheckedRecursiveAction() {
1625              protected void realCompute() {
1626 <                CCF f = new LCCF(null, 8);
1626 >                CCF f = new LCCF(8);
1627                  assertTrue(f.cancel(true));
1628                  assertSame(f, f.fork());
1629                  f.quietlyJoin();
# Line 1552 | Line 1638 | public class CountedCompleterTest extend
1638      public void testCompleteExceptionallySingleton() {
1639          ForkJoinTask a = new CheckedRecursiveAction() {
1640              protected void realCompute() {
1641 <                CCF f = new LCCF(null, 8);
1642 <                f.completeExceptionally(new FJException());
1643 <                try {
1644 <                    f.invoke();
1645 <                    shouldThrow();
1646 <                } catch (FJException success) {
1561 <                    checkCompletedAbnormally(f, success);
1562 <                }
1641 >                CCF n = new LCCF(8);
1642 >                CCF f = new LCCF(n, 8);
1643 >                FJException ex = new FJException();
1644 >                f.completeExceptionally(ex);
1645 >                f.checkCompletedExceptionally(ex);
1646 >                n.checkCompletedExceptionally(ex);
1647              }};
1648          testInvokeOnPool(singletonPool(), a);
1649      }
# Line 1570 | Line 1654 | public class CountedCompleterTest extend
1654      public void testInvokeAll2Singleton() {
1655          ForkJoinTask a = new CheckedRecursiveAction() {
1656              protected void realCompute() {
1657 <                CCF f = new LCCF(null, 8);
1658 <                CCF g = new LCCF(null, 9);
1657 >                CCF f = new LCCF(8);
1658 >                CCF g = new LCCF(9);
1659                  invokeAll(f, g);
1660                  assertEquals(21, f.number);
1661                  assertEquals(34, g.number);
# Line 1587 | Line 1671 | public class CountedCompleterTest extend
1671      public void testInvokeAll1Singleton() {
1672          ForkJoinTask a = new CheckedRecursiveAction() {
1673              protected void realCompute() {
1674 <                CCF f = new LCCF(null, 8);
1674 >                CCF f = new LCCF(8);
1675                  invokeAll(f);
1676                  checkCompletedNormally(f);
1677                  assertEquals(21, f.number);
# Line 1601 | Line 1685 | public class CountedCompleterTest extend
1685      public void testInvokeAll3Singleton() {
1686          ForkJoinTask a = new CheckedRecursiveAction() {
1687              protected void realCompute() {
1688 <                CCF f = new LCCF(null, 8);
1689 <                CCF g = new LCCF(null, 9);
1690 <                CCF h = new LCCF(null, 7);
1688 >                CCF f = new LCCF(8);
1689 >                CCF g = new LCCF(9);
1690 >                CCF h = new LCCF(7);
1691                  invokeAll(f, g, h);
1692                  assertEquals(21, f.number);
1693                  assertEquals(34, g.number);
# Line 1621 | Line 1705 | public class CountedCompleterTest extend
1705      public void testInvokeAllCollectionSingleton() {
1706          ForkJoinTask a = new CheckedRecursiveAction() {
1707              protected void realCompute() {
1708 <                CCF f = new LCCF(null, 8);
1709 <                CCF g = new LCCF(null, 9);
1710 <                CCF h = new LCCF(null, 7);
1708 >                CCF f = new LCCF(8);
1709 >                CCF g = new LCCF(9);
1710 >                CCF h = new LCCF(7);
1711                  HashSet set = new HashSet();
1712                  set.add(f);
1713                  set.add(g);
# Line 1645 | Line 1729 | public class CountedCompleterTest extend
1729      public void testInvokeAllNPESingleton() {
1730          ForkJoinTask a = new CheckedRecursiveAction() {
1731              protected void realCompute() {
1732 <                CCF f = new LCCF(null, 8);
1733 <                CCF g = new LCCF(null, 9);
1732 >                CCF f = new LCCF(8);
1733 >                CCF g = new LCCF(9);
1734                  CCF h = null;
1735                  try {
1736                      invokeAll(f, g, h);
# Line 1662 | Line 1746 | public class CountedCompleterTest extend
1746      public void testAbnormalInvokeAll2Singleton() {
1747          ForkJoinTask a = new CheckedRecursiveAction() {
1748              protected void realCompute() {
1749 <                CCF f = new LCCF(null, 8);
1750 <                FailingCCF g = new LFCCF(null, 9);
1749 >                CCF f = new LCCF(8);
1750 >                FailingCCF g = new LFCCF(9);
1751                  try {
1752                      invokeAll(f, g);
1753                      shouldThrow();
# Line 1680 | Line 1764 | public class CountedCompleterTest extend
1764      public void testAbnormalInvokeAll1Singleton() {
1765          ForkJoinTask a = new CheckedRecursiveAction() {
1766              protected void realCompute() {
1767 <                FailingCCF g = new LFCCF(null, 9);
1767 >                FailingCCF g = new LFCCF(9);
1768                  try {
1769                      invokeAll(g);
1770                      shouldThrow();
# Line 1697 | Line 1781 | public class CountedCompleterTest extend
1781      public void testAbnormalInvokeAll3Singleton() {
1782          ForkJoinTask a = new CheckedRecursiveAction() {
1783              protected void realCompute() {
1784 <                CCF f = new LCCF(null, 8);
1785 <                FailingCCF g = new LFCCF(null, 9);
1786 <                CCF h = new LCCF(null, 7);
1784 >                CCF f = new LCCF(8);
1785 >                FailingCCF g = new LFCCF(9);
1786 >                CCF h = new LCCF(7);
1787                  try {
1788                      invokeAll(f, g, h);
1789                      shouldThrow();
# Line 1716 | Line 1800 | public class CountedCompleterTest extend
1800      public void testAbnormalInvokeAllCollectionSingleton() {
1801          ForkJoinTask a = new CheckedRecursiveAction() {
1802              protected void realCompute() {
1803 <                FailingCCF f = new LFCCF(null, 8);
1804 <                CCF g = new LCCF(null, 9);
1805 <                CCF h = new LCCF(null, 7);
1803 >                FailingCCF f = new LFCCF(8);
1804 >                CCF g = new LCCF(9);
1805 >                CCF h = new LCCF(7);
1806                  HashSet set = new HashSet();
1807                  set.add(f);
1808                  set.add(g);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines