267 |
|
assertEquals(21, f.result); |
268 |
|
checkCompletedNormally(f); |
269 |
|
|
270 |
< |
f.reinitialize(); |
270 |
> |
f = new FibAction(8); |
271 |
|
f.cancel(true); |
272 |
|
assertSame(f, f.fork()); |
273 |
|
myself.interrupt(); |
280 |
|
checkCancelled(f); |
281 |
|
} |
282 |
|
|
283 |
< |
f.reinitialize(); |
283 |
> |
f = new FibAction(8); |
284 |
|
f.completeExceptionally(new FJException()); |
285 |
|
assertSame(f, f.fork()); |
286 |
|
myself.interrupt(); |
294 |
|
} |
295 |
|
|
296 |
|
// test quietlyJoin() |
297 |
< |
f.reinitialize(); |
297 |
> |
f = new FibAction(8); |
298 |
|
assertSame(f, f.fork()); |
299 |
|
myself.interrupt(); |
300 |
|
assertTrue(myself.isInterrupted()); |
303 |
|
assertEquals(21, f.result); |
304 |
|
checkCompletedNormally(f); |
305 |
|
|
306 |
< |
f.reinitialize(); |
306 |
> |
f = new FibAction(8); |
307 |
|
f.cancel(true); |
308 |
|
assertSame(f, f.fork()); |
309 |
|
myself.interrupt(); |
312 |
|
Thread.interrupted(); |
313 |
|
checkCancelled(f); |
314 |
|
|
315 |
< |
f.reinitialize(); |
315 |
> |
f = new FibAction(8); |
316 |
|
f.completeExceptionally(new FJException()); |
317 |
|
assertSame(f, f.fork()); |
318 |
|
myself.interrupt(); |
789 |
|
} |
790 |
|
|
791 |
|
/** |
792 |
< |
* A reinitialized task may be re-invoked |
792 |
> |
* A reinitialized normally completed task may be re-invoked |
793 |
|
*/ |
794 |
|
public void testReinitialize() { |
795 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
804 |
|
f.reinitialize(); |
805 |
|
checkNotDone(f); |
806 |
|
} |
807 |
+ |
}}; |
808 |
+ |
testInvokeOnPool(mainPool(), a); |
809 |
+ |
} |
810 |
+ |
|
811 |
+ |
/** |
812 |
+ |
* A reinitialized abnormally completed task may be re-invoked |
813 |
+ |
*/ |
814 |
+ |
public void testReinitializeAbnormal() { |
815 |
+ |
RecursiveAction a = new CheckedRecursiveAction() { |
816 |
+ |
public void realCompute() { |
817 |
+ |
FailingFibAction f = new FailingFibAction(8); |
818 |
+ |
checkNotDone(f); |
819 |
+ |
|
820 |
+ |
for (int i = 0; i < 3; i++) { |
821 |
+ |
try { |
822 |
+ |
f.invoke(); |
823 |
+ |
shouldThrow(); |
824 |
+ |
} catch (FJException success) { |
825 |
+ |
checkCompletedAbnormally(f, success); |
826 |
+ |
} |
827 |
+ |
f.reinitialize(); |
828 |
+ |
checkNotDone(f); |
829 |
+ |
} |
830 |
|
}}; |
831 |
|
testInvokeOnPool(mainPool(), a); |
832 |
|
} |