269 |
|
RecursiveAction a = new CheckedRecursiveAction() { |
270 |
|
protected void realCompute() { |
271 |
|
FibAction f = new FibAction(8); |
272 |
< |
final Thread myself = Thread.currentThread(); |
272 |
> |
final Thread currentThread = Thread.currentThread(); |
273 |
|
|
274 |
|
// test join() |
275 |
|
assertSame(f, f.fork()); |
276 |
< |
myself.interrupt(); |
277 |
< |
assertTrue(myself.isInterrupted()); |
276 |
> |
currentThread.interrupt(); |
277 |
> |
assertTrue(currentThread.isInterrupted()); |
278 |
|
assertNull(f.join()); |
279 |
|
Thread.interrupted(); |
280 |
|
assertEquals(21, f.result); |
283 |
|
f = new FibAction(8); |
284 |
|
f.cancel(true); |
285 |
|
assertSame(f, f.fork()); |
286 |
< |
myself.interrupt(); |
287 |
< |
assertTrue(myself.isInterrupted()); |
286 |
> |
currentThread.interrupt(); |
287 |
> |
assertTrue(currentThread.isInterrupted()); |
288 |
|
try { |
289 |
|
f.join(); |
290 |
|
shouldThrow(); |
296 |
|
f = new FibAction(8); |
297 |
|
f.completeExceptionally(new FJException()); |
298 |
|
assertSame(f, f.fork()); |
299 |
< |
myself.interrupt(); |
300 |
< |
assertTrue(myself.isInterrupted()); |
299 |
> |
currentThread.interrupt(); |
300 |
> |
assertTrue(currentThread.isInterrupted()); |
301 |
|
try { |
302 |
|
f.join(); |
303 |
|
shouldThrow(); |
309 |
|
// test quietlyJoin() |
310 |
|
f = new FibAction(8); |
311 |
|
assertSame(f, f.fork()); |
312 |
< |
myself.interrupt(); |
313 |
< |
assertTrue(myself.isInterrupted()); |
312 |
> |
currentThread.interrupt(); |
313 |
> |
assertTrue(currentThread.isInterrupted()); |
314 |
|
f.quietlyJoin(); |
315 |
|
Thread.interrupted(); |
316 |
|
assertEquals(21, f.result); |
319 |
|
f = new FibAction(8); |
320 |
|
f.cancel(true); |
321 |
|
assertSame(f, f.fork()); |
322 |
< |
myself.interrupt(); |
323 |
< |
assertTrue(myself.isInterrupted()); |
322 |
> |
currentThread.interrupt(); |
323 |
> |
assertTrue(currentThread.isInterrupted()); |
324 |
|
f.quietlyJoin(); |
325 |
|
Thread.interrupted(); |
326 |
|
checkCancelled(f); |
328 |
|
f = new FibAction(8); |
329 |
|
f.completeExceptionally(new FJException()); |
330 |
|
assertSame(f, f.fork()); |
331 |
< |
myself.interrupt(); |
332 |
< |
assertTrue(myself.isInterrupted()); |
331 |
> |
currentThread.interrupt(); |
332 |
> |
assertTrue(currentThread.isInterrupted()); |
333 |
|
f.quietlyJoin(); |
334 |
|
Thread.interrupted(); |
335 |
|
checkCompletedAbnormally(f, f.getException()); |