228 |
|
} |
229 |
|
|
230 |
|
/** |
231 |
< |
* A newly constructed CountedCompleter is not completed; |
231 |
> |
* A newly constructed CountedCompleter is not completed; |
232 |
|
* complete() causes completion. |
233 |
|
*/ |
234 |
|
public void testComplete() { |
320 |
|
CountedCompleter b = new NoopCountedCompleter(a); |
321 |
|
assertEquals(a, b.getCompleter()); |
322 |
|
} |
323 |
< |
|
323 |
> |
|
324 |
|
/** |
325 |
|
* getRoot returns self if no parent, else parent's root |
326 |
|
*/ |
330 |
|
assertEquals(a, a.getRoot()); |
331 |
|
assertEquals(a, b.getRoot()); |
332 |
|
} |
333 |
< |
|
333 |
> |
|
334 |
|
/** |
335 |
|
* tryComplete causes completion if pending count is zero |
336 |
|
*/ |
414 |
|
// Invocation tests use some interdependent task classes |
415 |
|
// to better test propagation etc |
416 |
|
|
417 |
< |
|
417 |
> |
|
418 |
|
// Version of Fibonacci with different classes for left vs right forks |
419 |
< |
static abstract class CCF extends CountedCompleter { |
419 |
> |
abstract static class CCF extends CountedCompleter { |
420 |
|
int number; |
421 |
|
int rnumber; |
422 |
|
|
437 |
|
f.onCompletion(f); |
438 |
|
if ((p = f.getCompleter()) != null) |
439 |
|
p.tryComplete(); |
440 |
< |
else |
441 |
< |
f.quietlyComplete(); |
440 |
> |
else |
441 |
> |
f.quietlyComplete(); |
442 |
|
} |
443 |
|
} |
444 |
|
|
470 |
|
} |
471 |
|
|
472 |
|
// Version of CCF with forced failure in left completions |
473 |
< |
static abstract class FailingCCF extends CountedCompleter { |
473 |
> |
abstract static class FailingCCF extends CountedCompleter { |
474 |
|
int number; |
475 |
|
int rnumber; |
476 |
|
|
491 |
|
f.onCompletion(f); |
492 |
|
if ((p = f.getCompleter()) != null) |
493 |
|
p.tryComplete(); |
494 |
< |
else |
495 |
< |
f.quietlyComplete(); |
494 |
> |
else |
495 |
> |
f.quietlyComplete(); |
496 |
|
} |
497 |
|
} |
498 |
|
|
517 |
|
completeExceptionally(new FJException()); |
518 |
|
} |
519 |
|
} |
520 |
< |
|
520 |
> |
|
521 |
|
/** |
522 |
|
* invoke returns when task completes normally. |
523 |
|
* isCompletedAbnormally and isCancelled return false for normally |