--- jsr166/src/test/tck/JSR166TestCase.java 2015/10/03 23:17:03 1.158 +++ jsr166/src/test/tck/JSR166TestCase.java 2015/10/04 00:30:50 1.159 @@ -770,13 +770,17 @@ public class JSR166TestCase extends Test /** * Allows use of try-with-resources with per-test thread pools. */ - class PoolCloser + class PoolCleaner implements AutoCloseable { public final T pool; - public PoolCloser(T pool) { this.pool = pool; } + public PoolCleaner(T pool) { this.pool = pool; } public void close() { joinPool(pool); } } + PoolCleaner cleaner(T pool) { + return new PoolCleaner(pool); + } + /** * Waits out termination of a thread pool or fails doing so. */ @@ -809,9 +813,9 @@ public class JSR166TestCase extends Test * necessarily individually slow because they must block. */ void testInParallel(Action ... actions) { - try (PoolCloser poolCloser - = new PoolCloser<>(Executors.newCachedThreadPool())) { - ExecutorService pool = poolCloser.pool; + try (PoolCleaner cleaner + = cleaner(Executors.newCachedThreadPool())) { + ExecutorService pool = cleaner.pool; ArrayList> futures = new ArrayList<>(actions.length); for (final Action action : actions) futures.add(pool.submit(new CheckedRunnable() {