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.82 by jsr166, Sun Oct 4 02:26:47 2015 UTC vs.
Revision 1.83 by jsr166, Sun Oct 4 02:29:46 2015 UTC

# Line 471 | Line 471 | public class ThreadPoolExecutorTest exte
471              new ThreadPoolExecutor(1, 1,
472                                     LONG_DELAY_MS, MILLISECONDS,
473                                     new ArrayBlockingQueue<Runnable>(10));
474 <        final CountDownLatch threadStarted = new CountDownLatch(1);
475 <        final CountDownLatch done = new CountDownLatch(1);
476 <        assertFalse(p.isTerminated());
477 <        try {
474 >        try (PoolCleaner cleaner = cleaner(p)) {
475 >            final CountDownLatch threadStarted = new CountDownLatch(1);
476 >            final CountDownLatch done = new CountDownLatch(1);
477 >            assertFalse(p.isTerminating());
478              p.execute(new CheckedRunnable() {
479                  public void realRun() throws InterruptedException {
480 <                    assertFalse(p.isTerminated());
480 >                    assertFalse(p.isTerminating());
481                      threadStarted.countDown();
482                      done.await();
483                  }});
484              assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
485              assertFalse(p.isTerminating());
486              done.countDown();
487        } finally {
487              try { p.shutdown(); } catch (SecurityException ok) { return; }
488 +            assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
489 +            assertTrue(p.isTerminated());
490 +            assertFalse(p.isTerminating());
491          }
490        assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
491        assertTrue(p.isTerminated());
492      }
493  
494      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines