test/jdk/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java
changeset 58138 1e4270f875ee
parent 48842 a5a2e4770524
equal deleted inserted replaced
58137:6a556bcd94fc 58138:1e4270f875ee
   794                           new ArrayBlockingQueue<Runnable>(10));
   794                           new ArrayBlockingQueue<Runnable>(10));
   795         final CountDownLatch threadsStarted = new CountDownLatch(poolSize);
   795         final CountDownLatch threadsStarted = new CountDownLatch(poolSize);
   796         Runnable waiter = new CheckedRunnable() { public void realRun() {
   796         Runnable waiter = new CheckedRunnable() { public void realRun() {
   797             threadsStarted.countDown();
   797             threadsStarted.countDown();
   798             try {
   798             try {
   799                 MILLISECONDS.sleep(2 * LONG_DELAY_MS);
   799                 MILLISECONDS.sleep(LONGER_DELAY_MS);
   800             } catch (InterruptedException success) {}
   800             } catch (InterruptedException success) {}
   801             ran.getAndIncrement();
   801             ran.getAndIncrement();
   802         }};
   802         }};
   803         for (int i = 0; i < count; i++)
   803         for (int i = 0; i < count; i++)
   804             p.execute(waiter);
   804             p.execute(waiter);
  1667         try (PoolCleaner cleaner = cleaner(e)) {
  1667         try (PoolCleaner cleaner = cleaner(e)) {
  1668             List<Callable<String>> l = new ArrayList<>();
  1668             List<Callable<String>> l = new ArrayList<>();
  1669             l.add(latchAwaitingStringTask(latch));
  1669             l.add(latchAwaitingStringTask(latch));
  1670             l.add(null);
  1670             l.add(null);
  1671             try {
  1671             try {
  1672                 e.invokeAny(l, randomTimeout(), MILLISECONDS);
  1672                 e.invokeAny(l, randomTimeout(), randomTimeUnit());
  1673                 shouldThrow();
  1673                 shouldThrow();
  1674             } catch (NullPointerException success) {}
  1674             } catch (NullPointerException success) {}
  1675             latch.countDown();
  1675             latch.countDown();
  1676         }
  1676         }
  1677     }
  1677     }