ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ThreadPoolExecutorTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ThreadPoolExecutorTest.java (file contents):
Revision 1.75 by jsr166, Sun Oct 4 02:00:19 2015 UTC vs.
Revision 1.76 by jsr166, Sun Oct 4 02:04:56 2015 UTC

# Line 339 | Line 339 | public class ThreadPoolExecutorTest exte
339              new ThreadPoolExecutor(THREADS, THREADS,
340                                     LONG_DELAY_MS, MILLISECONDS,
341                                     new ArrayBlockingQueue<Runnable>(10));
342 <        final CountDownLatch threadsStarted = new CountDownLatch(THREADS);
343 <        final CountDownLatch done = new CountDownLatch(1);
344 <        try {
342 >        try (PoolCleaner cleaner = cleaner(p)) {
343 >            final CountDownLatch threadsStarted = new CountDownLatch(THREADS);
344 >            final CountDownLatch done = new CountDownLatch(1);
345              assertEquals(0, p.getLargestPoolSize());
346              for (int i = 0; i < THREADS; i++)
347                  p.execute(new CheckedRunnable() {
# Line 350 | Line 350 | public class ThreadPoolExecutorTest exte
350                          done.await();
351                          assertEquals(THREADS, p.getLargestPoolSize());
352                      }});
353 <            assertTrue(threadsStarted.await(SMALL_DELAY_MS, MILLISECONDS));
354 <            assertEquals(THREADS, p.getLargestPoolSize());
355 <        } finally {
356 <            done.countDown();
357 <            joinPool(p);
353 >            assertTrue(threadsStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
354              assertEquals(THREADS, p.getLargestPoolSize());
355 +            done.countDown();   // release pool
356          }
357 +        assertEquals(THREADS, p.getLargestPoolSize());
358      }
359  
360      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines