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.86 by jsr166, Sun Oct 4 02:34:48 2015 UTC vs.
Revision 1.87 by jsr166, Sun Oct 4 02:38:46 2015 UTC

# Line 563 | Line 563 | public class ThreadPoolExecutorTest exte
563              new ThreadPoolExecutor(1, 1,
564                                     LONG_DELAY_MS, MILLISECONDS,
565                                     q);
566 <        Runnable[] tasks = new Runnable[5];
567 <        final CountDownLatch threadStarted = new CountDownLatch(1);
568 <        final CountDownLatch done = new CountDownLatch(1);
569 <        try {
566 >        try (PoolCleaner cleaner = cleaner(p)) {
567 >            Runnable[] tasks = new Runnable[6];
568 >            final CountDownLatch threadStarted = new CountDownLatch(1);
569 >            final CountDownLatch done = new CountDownLatch(1);
570              for (int i = 0; i < tasks.length; i++) {
571                  tasks[i] = new CheckedRunnable() {
572                      public void realRun() throws InterruptedException {
# Line 585 | Line 585 | public class ThreadPoolExecutorTest exte
585              assertTrue(q.contains(tasks[3]));
586              assertTrue(p.remove(tasks[3]));
587              assertFalse(q.contains(tasks[3]));
588        } finally {
588              done.countDown();
590            joinPool(p);
589          }
590      }
591  
# Line 602 | Line 600 | public class ThreadPoolExecutorTest exte
600              new ThreadPoolExecutor(1, 1,
601                                     LONG_DELAY_MS, MILLISECONDS,
602                                     q);
603 <        FutureTask[] tasks = new FutureTask[5];
604 <        try {
603 >        try (PoolCleaner cleaner = cleaner(p)) {
604 >            FutureTask[] tasks = new FutureTask[5];
605              for (int i = 0; i < tasks.length; i++) {
606                  Callable task = new CheckedCallable<Boolean>() {
607                      public Boolean realCall() throws InterruptedException {
# Line 627 | Line 625 | public class ThreadPoolExecutorTest exte
625              p.purge();         // Nothing to do
626              assertEquals(tasks.length - 3, q.size());
627              assertEquals(tasks.length - 2, p.getTaskCount());
630        } finally {
628              done.countDown();
632            joinPool(p);
629          }
630      }
631  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines