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

Comparing jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java (file contents):
Revision 1.71 by jsr166, Sun Oct 4 02:34:48 2015 UTC vs.
Revision 1.72 by jsr166, Sun Oct 4 02:38:45 2015 UTC

# Line 678 | Line 678 | public class ThreadPoolExecutorSubclassT
678              new CustomTPE(1, 1,
679                            LONG_DELAY_MS, MILLISECONDS,
680                            q);
681 <        Runnable[] tasks = new Runnable[6];
682 <        final CountDownLatch threadStarted = new CountDownLatch(1);
683 <        final CountDownLatch done = new CountDownLatch(1);
684 <        try {
681 >        try (PoolCleaner cleaner = cleaner(p)) {
682 >            Runnable[] tasks = new Runnable[6];
683 >            final CountDownLatch threadStarted = new CountDownLatch(1);
684 >            final CountDownLatch done = new CountDownLatch(1);
685              for (int i = 0; i < tasks.length; i++) {
686                  tasks[i] = new CheckedRunnable() {
687 <                        public void realRun() throws InterruptedException {
688 <                            threadStarted.countDown();
689 <                            done.await();
690 <                        }};
687 >                    public void realRun() throws InterruptedException {
688 >                        threadStarted.countDown();
689 >                        done.await();
690 >                    }};
691                  p.execute(tasks[i]);
692              }
693              assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
# Line 700 | Line 700 | public class ThreadPoolExecutorSubclassT
700              assertTrue(q.contains(tasks[3]));
701              assertTrue(p.remove(tasks[3]));
702              assertFalse(q.contains(tasks[3]));
703        } finally {
703              done.countDown();
705            joinPool(p);
704          }
705      }
706  
# Line 717 | Line 715 | public class ThreadPoolExecutorSubclassT
715              new CustomTPE(1, 1,
716                            LONG_DELAY_MS, MILLISECONDS,
717                            q);
718 <        FutureTask[] tasks = new FutureTask[5];
719 <        try {
718 >        try (PoolCleaner cleaner = cleaner(p)) {
719 >            FutureTask[] tasks = new FutureTask[5];
720              for (int i = 0; i < tasks.length; i++) {
721                  Callable task = new CheckedCallable<Boolean>() {
722                      public Boolean realCall() throws InterruptedException {
# Line 742 | Line 740 | public class ThreadPoolExecutorSubclassT
740              p.purge();         // Nothing to do
741              assertEquals(tasks.length - 3, q.size());
742              assertEquals(tasks.length - 2, p.getTaskCount());
745        } finally {
743              done.countDown();
747            joinPool(p);
744          }
745      }
746  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines