ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/RecursiveActionTest.java
(Generate patch)

Comparing jsr166/src/test/tck/RecursiveActionTest.java (file contents):
Revision 1.27 by jsr166, Tue Nov 23 08:48:23 2010 UTC vs.
Revision 1.28 by jsr166, Wed Dec 1 22:37:51 2010 UTC

# Line 255 | Line 255 | public class RecursiveActionTest extends
255          RecursiveAction a = new CheckedRecursiveAction() {
256              public void realCompute() {
257                  FibAction f = new FibAction(8);
258 +                final Thread myself = Thread.currentThread();
259  
260                  // test join()
261                  assertSame(f, f.fork());
262 <                Thread.currentThread().interrupt();
262 >                myself.interrupt();
263 >                assertTrue(myself.isInterrupted());
264                  assertNull(f.join());
265                  Thread.interrupted();
266                  assertEquals(21, f.result);
# Line 267 | Line 269 | public class RecursiveActionTest extends
269                  f.reinitialize();
270                  f.cancel(true);
271                  assertSame(f, f.fork());
272 <                Thread.currentThread().interrupt();
272 >                myself.interrupt();
273 >                assertTrue(myself.isInterrupted());
274                  try {
275                      f.join();
276                      shouldThrow();
# Line 279 | Line 282 | public class RecursiveActionTest extends
282                  f.reinitialize();
283                  f.completeExceptionally(new FJException());
284                  assertSame(f, f.fork());
285 <                Thread.currentThread().interrupt();
285 >                myself.interrupt();
286 >                assertTrue(myself.isInterrupted());
287                  try {
288                      f.join();
289                      shouldThrow();
# Line 291 | Line 295 | public class RecursiveActionTest extends
295                  // test quietlyJoin()
296                  f.reinitialize();
297                  assertSame(f, f.fork());
298 <                Thread.currentThread().interrupt();
298 >                myself.interrupt();
299 >                assertTrue(myself.isInterrupted());
300                  f.quietlyJoin();
301                  Thread.interrupted();
302                  assertEquals(21, f.result);
# Line 300 | Line 305 | public class RecursiveActionTest extends
305                  f.reinitialize();
306                  f.cancel(true);
307                  assertSame(f, f.fork());
308 <                Thread.currentThread().interrupt();
308 >                myself.interrupt();
309 >                assertTrue(myself.isInterrupted());
310                  f.quietlyJoin();
311                  Thread.interrupted();
312                  checkCancelled(f);
# Line 308 | Line 314 | public class RecursiveActionTest extends
314                  f.reinitialize();
315                  f.completeExceptionally(new FJException());
316                  assertSame(f, f.fork());
317 <                Thread.currentThread().interrupt();
317 >                myself.interrupt();
318 >                assertTrue(myself.isInterrupted());
319                  f.quietlyJoin();
320                  Thread.interrupted();
321                  checkCompletedAbnormally(f, f.getException());
# Line 348 | Line 355 | public class RecursiveActionTest extends
355              public void realRun() throws InterruptedException {
356                  FibAction[] fibActions = sq.take();
357                  FibAction f;
358 +                final Thread myself = Thread.currentThread();
359  
360                  // test join() ------------
361  
362                  f = fibActions[0];
363                  assertFalse(ForkJoinTask.inForkJoinPool());
364 <                Thread.currentThread().interrupt();
364 >                myself.interrupt();
365 >                assertTrue(myself.isInterrupted());
366                  assertNull(f.join());
367                  assertTrue(Thread.interrupted());
368                  assertEquals(21, f.result);
369                  checkCompletedNormally(f);
370  
371                  f = fibActions[1];
372 <                Thread.currentThread().interrupt();
372 >                myself.interrupt();
373 >                assertTrue(myself.isInterrupted());
374                  try {
375                      f.join();
376                      shouldThrow();
# Line 370 | Line 380 | public class RecursiveActionTest extends
380                  }
381  
382                  f = fibActions[2];
383 <                Thread.currentThread().interrupt();
383 >                myself.interrupt();
384 >                assertTrue(myself.isInterrupted());
385                  try {
386                      f.join();
387                      shouldThrow();
# Line 382 | Line 393 | public class RecursiveActionTest extends
393                  // test quietlyJoin() ---------
394  
395                  f = fibActions[3];
396 <                Thread.currentThread().interrupt();
396 >                myself.interrupt();
397 >                assertTrue(myself.isInterrupted());
398                  f.quietlyJoin();
399                  assertTrue(Thread.interrupted());
400                  assertEquals(21, f.result);
401                  checkCompletedNormally(f);
402  
403                  f = fibActions[4];
404 <                Thread.currentThread().interrupt();
404 >                myself.interrupt();
405 >                assertTrue(myself.isInterrupted());
406                  f.quietlyJoin();
407                  assertTrue(Thread.interrupted());
408                  checkCancelled(f);
409  
410                  f = fibActions[5];
411 <                Thread.currentThread().interrupt();
411 >                myself.interrupt();
412 >                assertTrue(myself.isInterrupted());
413                  f.quietlyJoin();
414                  assertTrue(Thread.interrupted());
415                  assertTrue(f.getException() instanceof FJException);
# Line 755 | Line 769 | public class RecursiveActionTest extends
769          RecursiveAction a = new CheckedRecursiveAction() {
770              public void realCompute() {
771                  ForkJoinWorkerThread w =
772 <                    (ForkJoinWorkerThread)(Thread.currentThread());
772 >                    (ForkJoinWorkerThread) Thread.currentThread();
773                  assertTrue(w.getPoolIndex() >= 0);
774                  assertTrue(w.getPoolIndex() < mainPool.getPoolSize());
775              }};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines