--- jsr166/src/test/tck/ForkJoinPoolTest.java 2015/10/05 22:54:45 1.64 +++ jsr166/src/test/tck/ForkJoinPoolTest.java 2015/10/06 21:22:54 1.65 @@ -256,23 +256,23 @@ public class ForkJoinPoolTest extends JS */ public void testSetUncaughtExceptionHandler() throws InterruptedException { final CountDownLatch uehInvoked = new CountDownLatch(1); - final Thread.UncaughtExceptionHandler eh = + final Thread.UncaughtExceptionHandler ueh = new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { uehInvoked.countDown(); }}; ForkJoinPool p = new ForkJoinPool(1, new FailingThreadFactory(), - eh, false); - try { - assertSame(eh, p.getUncaughtExceptionHandler()); + ueh, false); + try (PoolCleaner cleaner = cleaner(p)) { + assertSame(ueh, p.getUncaughtExceptionHandler()); try { - p.execute(new FibTask(8)); - assertTrue(uehInvoked.await(MEDIUM_DELAY_MS, MILLISECONDS)); - } catch (RejectedExecutionException ok) { + try { + p.execute(new FibTask(8)); + await(uehInvoked); + } catch (RejectedExecutionException ok) {} + } finally { + p.shutdownNow(); // failure might have prevented processing task } - } finally { - p.shutdownNow(); // failure might have prevented processing task - joinPool(p); } }