--- jsr166/src/test/tck/ForkJoinPoolTest.java 2011/05/27 19:42:42 1.41 +++ jsr166/src/test/tck/ForkJoinPoolTest.java 2012/01/10 13:48:27 1.44 @@ -22,6 +22,7 @@ import java.util.concurrent.ForkJoinTask import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.RecursiveTask; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.ReentrantLock; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.security.AccessControlException; @@ -241,8 +242,11 @@ public class ForkJoinPoolTest extends JS eh, false); try { assertSame(eh, p.getUncaughtExceptionHandler()); - p.execute(new FibTask(8)); - assertTrue(uehInvoked.await(MEDIUM_DELAY_MS, MILLISECONDS)); + try { + p.execute(new FibTask(8)); + assertTrue(uehInvoked.await(10000, MILLISECONDS)); + } catch(RejectedExecutionException ok) { + } } finally { p.shutdownNow(); // failure might have prevented processing task joinPool(p); @@ -255,7 +259,7 @@ public class ForkJoinPoolTest extends JS * the task has completed successfully, and construction * parameters continue to hold */ - public void testisQuiescent() throws Exception { + public void testIsQuiescent() throws Exception { ForkJoinPool p = new ForkJoinPool(2); try { assertTrue(p.isQuiescent()); @@ -386,12 +390,15 @@ public class ForkJoinPoolTest extends JS public void testExecuteRunnable() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { - TrackedRunnable task = trackedRunnable(SHORT_DELAY_MS); - assertFalse(task.isDone()); + final AtomicBoolean done = new AtomicBoolean(false); + CheckedRunnable task = new CheckedRunnable() { + public void realRun() { + done.set(true); + }}; Future future = e.submit(task); assertNull(future.get()); - assertNull(future.get(MEDIUM_DELAY_MS, MILLISECONDS)); - assertTrue(task.isDone()); + assertNull(future.get(0, MILLISECONDS)); + assertTrue(done.get()); assertTrue(future.isDone()); assertFalse(future.isCancelled()); } finally {