--- jsr166/src/test/tck/JSR166TestCase.java 2015/09/28 08:23:49 1.148 +++ jsr166/src/test/tck/JSR166TestCase.java 2015/10/03 16:57:25 1.149 @@ -743,9 +743,19 @@ public class JSR166TestCase extends Test } /** + * Allows use of try-with-resources with per-test thread pools. + */ + static class PoolCloser + implements AutoCloseable { + public final T pool; + public PoolCloser(T pool) { this.pool = pool; } + public void close() { joinPool(pool); } + } + + /** * Waits out termination of a thread pool or fails doing so. */ - void joinPool(ExecutorService pool) { + static void joinPool(ExecutorService pool) { try { pool.shutdown(); if (!pool.awaitTermination(2 * LONG_DELAY_MS, MILLISECONDS))