94 |
|
RecursiveAction a = new RecursiveAction() { |
95 |
|
public void compute() { |
96 |
|
FibAction f = new FibAction(8); |
97 |
< |
f.invoke(); |
97 |
> |
threadAssertNull(f.invoke()); |
98 |
|
threadAssertTrue(f.result == 21); |
99 |
|
threadAssertTrue(f.isDone()); |
100 |
|
threadAssertFalse(f.isCancelled()); |
130 |
|
RecursiveAction a = new RecursiveAction() { |
131 |
|
public void compute() { |
132 |
|
FibAction f = new FibAction(8); |
133 |
< |
f.fork(); |
134 |
< |
f.join(); |
133 |
> |
threadAssertSame(f, f.fork()); |
134 |
> |
threadAssertNull(f.join()); |
135 |
|
threadAssertTrue(f.result == 21); |
136 |
|
threadAssertTrue(f.isDone()); |
137 |
|
threadAssertTrue(f.getRawResult() == null); |
147 |
|
public void compute() { |
148 |
|
try { |
149 |
|
FibAction f = new FibAction(8); |
150 |
< |
f.fork(); |
151 |
< |
f.get(); |
150 |
> |
threadAssertSame(f, f.fork()); |
151 |
> |
threadAssertNull(f.get()); |
152 |
|
threadAssertTrue(f.result == 21); |
153 |
|
threadAssertTrue(f.isDone()); |
154 |
|
} catch (Exception ex) { |
166 |
|
public void compute() { |
167 |
|
try { |
168 |
|
FibAction f = new FibAction(8); |
169 |
< |
f.fork(); |
170 |
< |
f.get(5L, TimeUnit.SECONDS); |
169 |
> |
threadAssertSame(f, f.fork()); |
170 |
> |
threadAssertNull(f.get(5L, TimeUnit.SECONDS)); |
171 |
|
threadAssertTrue(f.result == 21); |
172 |
|
threadAssertTrue(f.isDone()); |
173 |
|
} catch (Exception ex) { |
185 |
|
public void compute() { |
186 |
|
try { |
187 |
|
FibAction f = new FibAction(8); |
188 |
< |
f.fork(); |
188 |
> |
threadAssertSame(f, f.fork()); |
189 |
|
f.get(5L, null); |
190 |
|
shouldThrow(); |
191 |
|
} catch (NullPointerException success) { |
203 |
|
RecursiveAction a = new RecursiveAction() { |
204 |
|
public void compute() { |
205 |
|
FibAction f = new FibAction(8); |
206 |
< |
f.fork(); |
206 |
> |
threadAssertSame(f, f.fork()); |
207 |
|
f.quietlyJoin(); |
208 |
|
threadAssertTrue(f.result == 21); |
209 |
|
threadAssertTrue(f.isDone()); |
220 |
|
RecursiveAction a = new RecursiveAction() { |
221 |
|
public void compute() { |
222 |
|
FibAction f = new FibAction(8); |
223 |
< |
f.fork(); |
223 |
> |
threadAssertSame(f, f.fork()); |
224 |
|
f.helpQuiesce(); |
225 |
|
threadAssertTrue(f.result == 21); |
226 |
|
threadAssertTrue(f.isDone()); |
267 |
|
public void compute() { |
268 |
|
try { |
269 |
|
FailingFibAction f = new FailingFibAction(8); |
270 |
< |
f.fork(); |
270 |
> |
threadAssertSame(f, f.fork()); |
271 |
|
f.join(); |
272 |
|
shouldThrow(); |
273 |
|
} catch (FJException success) { |
284 |
|
public void compute() { |
285 |
|
try { |
286 |
|
FailingFibAction f = new FailingFibAction(8); |
287 |
< |
f.fork(); |
287 |
> |
threadAssertSame(f, f.fork()); |
288 |
|
f.get(); |
289 |
|
shouldThrow(); |
290 |
|
} catch (ExecutionException success) { |
303 |
|
public void compute() { |
304 |
|
try { |
305 |
|
FailingFibAction f = new FailingFibAction(8); |
306 |
< |
f.fork(); |
306 |
> |
threadAssertSame(f, f.fork()); |
307 |
|
f.get(5L, TimeUnit.SECONDS); |
308 |
|
shouldThrow(); |
309 |
|
} catch (ExecutionException success) { |
321 |
|
RecursiveAction a = new RecursiveAction() { |
322 |
|
public void compute() { |
323 |
|
FailingFibAction f = new FailingFibAction(8); |
324 |
< |
f.fork(); |
324 |
> |
threadAssertSame(f, f.fork()); |
325 |
|
f.quietlyJoin(); |
326 |
|
threadAssertTrue(f.isDone()); |
327 |
|
threadAssertTrue(f.isCompletedAbnormally()); |
338 |
|
public void compute() { |
339 |
|
try { |
340 |
|
FibAction f = new FibAction(8); |
341 |
< |
f.cancel(true); |
341 |
> |
threadAssertTrue(f.cancel(true)); |
342 |
|
f.invoke(); |
343 |
|
shouldThrow(); |
344 |
|
} catch (CancellationException success) { |
355 |
|
public void compute() { |
356 |
|
try { |
357 |
|
FibAction f = new FibAction(8); |
358 |
< |
f.cancel(true); |
359 |
< |
f.fork(); |
358 |
> |
threadAssertTrue(f.cancel(true)); |
359 |
> |
threadAssertSame(f, f.fork()); |
360 |
|
f.join(); |
361 |
|
shouldThrow(); |
362 |
|
} catch (CancellationException success) { |
373 |
|
public void compute() { |
374 |
|
try { |
375 |
|
FibAction f = new FibAction(8); |
376 |
< |
f.cancel(true); |
377 |
< |
f.fork(); |
376 |
> |
threadAssertTrue(f.cancel(true)); |
377 |
> |
threadAssertSame(f, f.fork()); |
378 |
|
f.get(); |
379 |
|
shouldThrow(); |
380 |
|
} catch (CancellationException success) { |
393 |
|
public void compute() { |
394 |
|
try { |
395 |
|
FibAction f = new FibAction(8); |
396 |
< |
f.cancel(true); |
397 |
< |
f.fork(); |
396 |
> |
threadAssertTrue(f.cancel(true)); |
397 |
> |
threadAssertSame(f, f.fork()); |
398 |
|
f.get(5L, TimeUnit.SECONDS); |
399 |
|
shouldThrow(); |
400 |
|
} catch (CancellationException success) { |
412 |
|
RecursiveAction a = new RecursiveAction() { |
413 |
|
public void compute() { |
414 |
|
FibAction f = new FibAction(8); |
415 |
< |
f.cancel(true); |
416 |
< |
f.fork(); |
415 |
> |
threadAssertTrue(f.cancel(true)); |
416 |
> |
threadAssertSame(f, f.fork()); |
417 |
|
f.quietlyJoin(); |
418 |
|
threadAssertTrue(f.isDone()); |
419 |
|
threadAssertTrue(f.isCompletedAbnormally()); |
442 |
|
public void compute() { |
443 |
|
threadAssertTrue(getPool() == null); |
444 |
|
}}; |
445 |
< |
a.invoke(); |
445 |
> |
assertNull(a.invoke()); |
446 |
|
} |
447 |
|
|
448 |
|
/** |
464 |
|
public void compute() { |
465 |
|
threadAssertTrue(!inForkJoinPool()); |
466 |
|
}}; |
467 |
< |
a.invoke(); |
467 |
> |
assertNull(a.invoke()); |
468 |
|
} |
469 |
|
|
470 |
|
/** |
506 |
|
public void compute() { |
507 |
|
setRawResult(null); |
508 |
|
}}; |
509 |
< |
a.invoke(); |
509 |
> |
assertNull(a.invoke()); |
510 |
|
} |
511 |
|
|
512 |
|
/** |
516 |
|
RecursiveAction a = new RecursiveAction() { |
517 |
|
public void compute() { |
518 |
|
FibAction f = new FibAction(8); |
519 |
< |
f.invoke(); |
519 |
> |
threadAssertNull(f.invoke()); |
520 |
|
threadAssertTrue(f.result == 21); |
521 |
|
threadAssertTrue(f.isDone()); |
522 |
|
threadAssertFalse(f.isCancelled()); |
523 |
|
threadAssertFalse(f.isCompletedAbnormally()); |
524 |
|
f.reinitialize(); |
525 |
< |
f.invoke(); |
525 |
> |
threadAssertNull(f.invoke()); |
526 |
|
threadAssertTrue(f.result == 21); |
527 |
|
}}; |
528 |
|
testInvokeOnPool(mainPool(), a); |
553 |
|
public void compute() { |
554 |
|
FibAction f = new FibAction(8); |
555 |
|
f.complete(null); |
556 |
< |
f.invoke(); |
556 |
> |
threadAssertNull(f.invoke()); |
557 |
|
threadAssertTrue(f.isDone()); |
558 |
|
threadAssertTrue(f.result == 0); |
559 |
|
}}; |
735 |
|
RecursiveAction a = new RecursiveAction() { |
736 |
|
public void compute() { |
737 |
|
FibAction g = new FibAction(9); |
738 |
< |
g.fork(); |
738 |
> |
threadAssertSame(g, g.fork()); |
739 |
|
FibAction f = new FibAction(8); |
740 |
< |
f.fork(); |
740 |
> |
threadAssertSame(f, f.fork()); |
741 |
|
threadAssertTrue(f.tryUnfork()); |
742 |
|
helpQuiesce(); |
743 |
|
threadAssertFalse(f.isDone()); |
754 |
|
RecursiveAction a = new RecursiveAction() { |
755 |
|
public void compute() { |
756 |
|
FibAction h = new FibAction(7); |
757 |
< |
h.fork(); |
757 |
> |
threadAssertSame(h, h.fork()); |
758 |
|
FibAction g = new FibAction(9); |
759 |
< |
g.fork(); |
759 |
> |
threadAssertSame(g, g.fork()); |
760 |
|
FibAction f = new FibAction(8); |
761 |
< |
f.fork(); |
761 |
> |
threadAssertSame(f, f.fork()); |
762 |
|
threadAssertTrue(getSurplusQueuedTaskCount() > 0); |
763 |
|
helpQuiesce(); |
764 |
|
}}; |
772 |
|
RecursiveAction a = new RecursiveAction() { |
773 |
|
public void compute() { |
774 |
|
FibAction g = new FibAction(9); |
775 |
< |
g.fork(); |
775 |
> |
threadAssertSame(g, g.fork()); |
776 |
|
FibAction f = new FibAction(8); |
777 |
< |
f.fork(); |
777 |
> |
threadAssertSame(f, f.fork()); |
778 |
|
threadAssertTrue(peekNextLocalTask() == f); |
779 |
< |
f.join(); |
779 |
> |
threadAssertNull(f.join()); |
780 |
|
threadAssertTrue(f.isDone()); |
781 |
|
helpQuiesce(); |
782 |
|
}}; |
791 |
|
RecursiveAction a = new RecursiveAction() { |
792 |
|
public void compute() { |
793 |
|
FibAction g = new FibAction(9); |
794 |
< |
g.fork(); |
794 |
> |
threadAssertSame(g, g.fork()); |
795 |
|
FibAction f = new FibAction(8); |
796 |
< |
f.fork(); |
796 |
> |
threadAssertSame(f, f.fork()); |
797 |
|
threadAssertTrue(pollNextLocalTask() == f); |
798 |
|
helpQuiesce(); |
799 |
|
threadAssertFalse(f.isDone()); |
809 |
|
RecursiveAction a = new RecursiveAction() { |
810 |
|
public void compute() { |
811 |
|
FibAction g = new FibAction(9); |
812 |
< |
g.fork(); |
812 |
> |
threadAssertSame(g, g.fork()); |
813 |
|
FibAction f = new FibAction(8); |
814 |
< |
f.fork(); |
814 |
> |
threadAssertSame(f, f.fork()); |
815 |
|
threadAssertTrue(pollTask() == f); |
816 |
|
helpQuiesce(); |
817 |
|
threadAssertFalse(f.isDone()); |
827 |
|
RecursiveAction a = new RecursiveAction() { |
828 |
|
public void compute() { |
829 |
|
FibAction g = new FibAction(9); |
830 |
< |
g.fork(); |
830 |
> |
threadAssertSame(g, g.fork()); |
831 |
|
FibAction f = new FibAction(8); |
832 |
< |
f.fork(); |
832 |
> |
threadAssertSame(f, f.fork()); |
833 |
|
threadAssertTrue(peekNextLocalTask() == g); |
834 |
< |
f.join(); |
834 |
> |
threadAssertNull(f.join()); |
835 |
|
helpQuiesce(); |
836 |
|
threadAssertTrue(f.isDone()); |
837 |
|
}}; |
846 |
|
RecursiveAction a = new RecursiveAction() { |
847 |
|
public void compute() { |
848 |
|
FibAction g = new FibAction(9); |
849 |
< |
g.fork(); |
849 |
> |
threadAssertSame(g, g.fork()); |
850 |
|
FibAction f = new FibAction(8); |
851 |
< |
f.fork(); |
851 |
> |
threadAssertSame(f, f.fork()); |
852 |
|
threadAssertTrue(pollNextLocalTask() == g); |
853 |
|
helpQuiesce(); |
854 |
|
threadAssertTrue(f.isDone()); |
865 |
|
RecursiveAction a = new RecursiveAction() { |
866 |
|
public void compute() { |
867 |
|
FibAction g = new FibAction(9); |
868 |
< |
g.fork(); |
868 |
> |
threadAssertSame(g, g.fork()); |
869 |
|
FibAction f = new FibAction(8); |
870 |
< |
f.fork(); |
870 |
> |
threadAssertSame(f, f.fork()); |
871 |
|
threadAssertTrue(pollTask() == g); |
872 |
|
helpQuiesce(); |
873 |
|
threadAssertTrue(f.isDone()); |