--- jsr166/src/test/tck/ScheduledExecutorTest.java 2015/10/04 08:07:31 1.62 +++ jsr166/src/test/tck/ScheduledExecutorTest.java 2015/10/05 20:45:41 1.64 @@ -438,10 +438,12 @@ public class ScheduledExecutorTest exten * getThreadFactory returns factory in constructor if not set */ public void testGetThreadFactory() throws InterruptedException { - ThreadFactory threadFactory = new SimpleThreadFactory(); - ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1, threadFactory); - assertSame(threadFactory, p.getThreadFactory()); - joinPool(p); + final ThreadFactory threadFactory = new SimpleThreadFactory(); + final ScheduledThreadPoolExecutor p = + new ScheduledThreadPoolExecutor(1, threadFactory); + try (PoolCleaner cleaner = cleaner(p)) { + assertSame(threadFactory, p.getThreadFactory()); + } } /** @@ -630,7 +632,7 @@ public class ScheduledExecutorTest exten final AtomicInteger ran = new AtomicInteger(0); final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(poolSize); - CountDownLatch threadsStarted = new CountDownLatch(poolSize); + final CountDownLatch threadsStarted = new CountDownLatch(poolSize); Runnable waiter = new CheckedRunnable() { public void realRun() { threadsStarted.countDown(); try {