--- jsr166/src/test/tck/JSR166TestCase.java 2017/05/29 19:15:02 1.232 +++ jsr166/src/test/tck/JSR166TestCase.java 2017/07/15 23:15:21 1.233 @@ -1951,6 +1951,16 @@ public class JSR166TestCase extends Test 1000L, MILLISECONDS, new SynchronousQueue()); + /** + * Returns maximum number of tasks that can be submitted to given + * pool (with bounded queue) before saturation (when submission + * throws RejectedExecutionException). + */ + static final int saturatedSize(ThreadPoolExecutor pool) { + BlockingQueue q = pool.getQueue(); + return pool.getMaximumPoolSize() + q.size() + q.remainingCapacity(); + } + static void shuffle(T[] array) { Collections.shuffle(Arrays.asList(array), ThreadLocalRandom.current()); }