--- jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java 2015/10/04 01:52:43 1.58 +++ jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java 2015/10/04 01:56:51 1.59 @@ -354,7 +354,7 @@ public class ThreadPoolExecutorSubclassT * getCorePoolSize returns size given in constructor if not otherwise set */ public void testGetCorePoolSize() { - ThreadPoolExecutor p = + final ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); @@ -367,7 +367,7 @@ public class ThreadPoolExecutorSubclassT * getKeepAliveTime returns value given in constructor if not otherwise set */ public void testGetKeepAliveTime() { - ThreadPoolExecutor p = + final ThreadPoolExecutor p = new CustomTPE(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue(10)); @@ -380,8 +380,8 @@ public class ThreadPoolExecutorSubclassT * getThreadFactory returns factory in constructor if not set */ public void testGetThreadFactory() { - ThreadFactory threadFactory = new SimpleThreadFactory(); - ThreadPoolExecutor p = + final ThreadFactory threadFactory = new SimpleThreadFactory(); + final ThreadPoolExecutor p = new CustomTPE(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), @@ -396,7 +396,7 @@ public class ThreadPoolExecutorSubclassT * setThreadFactory sets the thread factory returned by getThreadFactory */ public void testSetThreadFactory() { - ThreadPoolExecutor p = + final ThreadPoolExecutor p = new CustomTPE(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); @@ -411,7 +411,7 @@ public class ThreadPoolExecutorSubclassT * setThreadFactory(null) throws NPE */ public void testSetThreadFactoryNull() { - ThreadPoolExecutor p = + final ThreadPoolExecutor p = new CustomTPE(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); @@ -427,10 +427,15 @@ public class ThreadPoolExecutorSubclassT * getRejectedExecutionHandler returns handler in constructor if not set */ public void testGetRejectedExecutionHandler() { - RejectedExecutionHandler h = new NoOpREHandler(); - ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), h); - assertSame(h, p.getRejectedExecutionHandler()); - joinPool(p); + final RejectedExecutionHandler h = new NoOpREHandler(); + final ThreadPoolExecutor p = + new CustomTPE(1, 2, + LONG_DELAY_MS, MILLISECONDS, + new ArrayBlockingQueue(10), + h); + try (PoolCleaner cleaner = cleaner(p)) { + assertSame(h, p.getRejectedExecutionHandler()); + } } /**