90 |
|
assertNull(a.getException()); |
91 |
|
assertNull(a.getRawResult()); |
92 |
|
assertNull(a.join()); |
93 |
+ |
assertFalse(a.cancel(false)); |
94 |
+ |
assertFalse(a.cancel(true)); |
95 |
|
try { |
96 |
|
assertNull(a.get()); |
97 |
|
} catch (Throwable fail) { threadUnexpectedException(fail); } |
127 |
|
} catch (Throwable fail) { threadUnexpectedException(fail); } |
128 |
|
} |
129 |
|
|
130 |
< |
void checkTaskThrew(RecursiveAction a, Throwable t) { |
130 |
> |
void checkCompletedAbnormally(RecursiveAction a, Throwable t) { |
131 |
|
assertTrue(a.isDone()); |
132 |
|
assertFalse(a.isCancelled()); |
133 |
|
assertFalse(a.isCompletedNormally()); |
134 |
|
assertTrue(a.isCompletedAbnormally()); |
135 |
|
assertSame(t, a.getException()); |
136 |
|
assertNull(a.getRawResult()); |
137 |
+ |
assertFalse(a.cancel(false)); |
138 |
+ |
assertFalse(a.cancel(true)); |
139 |
|
|
140 |
|
try { |
141 |
|
a.join(); |
337 |
|
f.invoke(); |
338 |
|
shouldThrow(); |
339 |
|
} catch (FJException success) { |
340 |
< |
checkTaskThrew(f, success); |
340 |
> |
checkCompletedAbnormally(f, success); |
341 |
|
} |
342 |
|
}}; |
343 |
|
testInvokeOnPool(mainPool(), a); |
352 |
|
FailingFibAction f = new FailingFibAction(8); |
353 |
|
f.quietlyInvoke(); |
354 |
|
assertTrue(f.getException() instanceof FJException); |
355 |
< |
checkTaskThrew(f, f.getException()); |
355 |
> |
checkCompletedAbnormally(f, f.getException()); |
356 |
|
}}; |
357 |
|
testInvokeOnPool(mainPool(), a); |
358 |
|
} |
369 |
|
f.join(); |
370 |
|
shouldThrow(); |
371 |
|
} catch (FJException success) { |
372 |
< |
checkTaskThrew(f, success); |
372 |
> |
checkCompletedAbnormally(f, success); |
373 |
|
} |
374 |
|
}}; |
375 |
|
testInvokeOnPool(mainPool(), a); |
387 |
|
f.get(); |
388 |
|
shouldThrow(); |
389 |
|
} catch (ExecutionException success) { |
390 |
< |
checkTaskThrew(f, success.getCause()); |
390 |
> |
Throwable cause = success.getCause(); |
391 |
> |
assertTrue(cause instanceof FJException); |
392 |
> |
checkCompletedAbnormally(f, cause); |
393 |
|
} |
394 |
|
}}; |
395 |
|
testInvokeOnPool(mainPool(), a); |
407 |
|
f.get(5L, TimeUnit.SECONDS); |
408 |
|
shouldThrow(); |
409 |
|
} catch (ExecutionException success) { |
410 |
< |
checkTaskThrew(f, success.getCause()); |
410 |
> |
Throwable cause = success.getCause(); |
411 |
> |
assertTrue(cause instanceof FJException); |
412 |
> |
checkCompletedAbnormally(f, cause); |
413 |
|
} |
414 |
|
}}; |
415 |
|
testInvokeOnPool(mainPool(), a); |
425 |
|
assertSame(f, f.fork()); |
426 |
|
f.quietlyJoin(); |
427 |
|
assertTrue(f.getException() instanceof FJException); |
428 |
< |
checkTaskThrew(f, f.getException()); |
428 |
> |
checkCompletedAbnormally(f, f.getException()); |
429 |
|
}}; |
430 |
|
testInvokeOnPool(mainPool(), a); |
431 |
|
} |
602 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
603 |
|
public void realCompute() { |
604 |
|
setRawResult(null); |
605 |
+ |
assertNull(getRawResult()); |
606 |
|
}}; |
607 |
|
assertNull(a.invoke()); |
608 |
|
} |
639 |
|
f.invoke(); |
640 |
|
shouldThrow(); |
641 |
|
} catch (FJException success) { |
642 |
< |
checkTaskThrew(f, success); |
642 |
> |
checkCompletedAbnormally(f, success); |
643 |
|
} |
644 |
|
}}; |
645 |
|
testInvokeOnPool(mainPool(), a); |
771 |
|
invokeAll(f, g); |
772 |
|
shouldThrow(); |
773 |
|
} catch (FJException success) { |
774 |
< |
checkTaskThrew(g, success); |
774 |
> |
checkCompletedAbnormally(g, success); |
775 |
|
} |
776 |
|
}}; |
777 |
|
testInvokeOnPool(mainPool(), a); |
788 |
|
invokeAll(g); |
789 |
|
shouldThrow(); |
790 |
|
} catch (FJException success) { |
791 |
< |
checkTaskThrew(g, success); |
791 |
> |
checkCompletedAbnormally(g, success); |
792 |
|
} |
793 |
|
}}; |
794 |
|
testInvokeOnPool(mainPool(), a); |
807 |
|
invokeAll(f, g, h); |
808 |
|
shouldThrow(); |
809 |
|
} catch (FJException success) { |
810 |
< |
checkTaskThrew(g, success); |
810 |
> |
checkCompletedAbnormally(g, success); |
811 |
|
} |
812 |
|
}}; |
813 |
|
testInvokeOnPool(mainPool(), a); |
830 |
|
invokeAll(set); |
831 |
|
shouldThrow(); |
832 |
|
} catch (FJException success) { |
833 |
< |
checkTaskThrew(f, success); |
833 |
> |
checkCompletedAbnormally(f, success); |
834 |
|
} |
835 |
|
}}; |
836 |
|
testInvokeOnPool(mainPool(), a); |
870 |
|
assertSame(f, f.fork()); |
871 |
|
assertTrue(getSurplusQueuedTaskCount() > 0); |
872 |
|
helpQuiesce(); |
873 |
+ |
assertEquals(0, getSurplusQueuedTaskCount()); |
874 |
|
checkCompletedNormally(f); |
875 |
|
checkCompletedNormally(g); |
876 |
|
checkCompletedNormally(h); |