1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
import java.util.concurrent.ExecutionException; |
7 |
|
import java.util.concurrent.CancellationException; |
349 |
|
} |
350 |
|
} |
351 |
|
|
352 |
– |
|
352 |
|
static final class FailingAsyncFib extends BinaryAsyncAction { |
353 |
|
int number; |
354 |
|
public FailingAsyncFib(int n) { |
485 |
|
testInvokeOnPool(mainPool(), a); |
486 |
|
} |
487 |
|
|
489 |
– |
|
488 |
|
/** |
489 |
|
* helpQuiesce returns when tasks are complete. |
490 |
|
* getQueuedTaskCount returns 0 when quiescent |
494 |
|
public void realCompute() { |
495 |
|
AsyncFib f = new AsyncFib(8); |
496 |
|
assertSame(f, f.fork()); |
497 |
< |
f.helpQuiesce(); |
497 |
> |
helpQuiesce(); |
498 |
|
assertEquals(21, f.number); |
499 |
|
assertEquals(0, getQueuedTaskCount()); |
500 |
|
checkCompletedNormally(f); |
502 |
|
testInvokeOnPool(mainPool(), a); |
503 |
|
} |
504 |
|
|
507 |
– |
|
505 |
|
/** |
506 |
|
* invoke task throws exception when task completes abnormally |
507 |
|
*/ |
846 |
|
testInvokeOnPool(mainPool(), a); |
847 |
|
} |
848 |
|
|
852 |
– |
|
849 |
|
/** |
850 |
|
* invokeAll(tasks) with any null task throws NPE |
851 |
|
*/ |
1209 |
|
testInvokeOnPool(singletonPool(), a); |
1210 |
|
} |
1211 |
|
|
1216 |
– |
|
1212 |
|
/** |
1213 |
|
* helpQuiesce returns when tasks are complete. |
1214 |
|
* getQueuedTaskCount returns 0 when quiescent |
1218 |
|
public void realCompute() { |
1219 |
|
AsyncFib f = new AsyncFib(8); |
1220 |
|
assertSame(f, f.fork()); |
1221 |
< |
f.helpQuiesce(); |
1221 |
> |
helpQuiesce(); |
1222 |
|
assertEquals(0, getQueuedTaskCount()); |
1223 |
|
assertEquals(21, f.number); |
1224 |
|
checkCompletedNormally(f); |
1226 |
|
testInvokeOnPool(singletonPool(), a); |
1227 |
|
} |
1228 |
|
|
1234 |
– |
|
1229 |
|
/** |
1230 |
|
* invoke task throws exception when task completes abnormally |
1231 |
|
*/ |
1513 |
|
testInvokeOnPool(singletonPool(), a); |
1514 |
|
} |
1515 |
|
|
1522 |
– |
|
1516 |
|
/** |
1517 |
|
* invokeAll(tasks) with any null task throws NPE |
1518 |
|
*/ |