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

Comparing jsr166/src/test/tck/ScheduledExecutorSubclassTest.java (file contents):
Revision 1.54 by jsr166, Tue Oct 6 05:30:44 2015 UTC vs.
Revision 1.55 by jsr166, Tue Oct 6 05:56:01 2015 UTC

# Line 601 | Line 601 | public class ScheduledExecutorSubclassTe
601       * getQueue returns the work queue, which contains queued tasks
602       */
603      public void testGetQueue() throws InterruptedException {
604 +        final CountDownLatch done = new CountDownLatch(1);
605          final ScheduledThreadPoolExecutor p = new CustomExecutor(1);
606 <        try (PoolCleaner cleaner = cleaner(p)) {
606 >        try (PoolCleaner cleaner = cleaner(p, done)) {
607              final CountDownLatch threadStarted = new CountDownLatch(1);
607            final CountDownLatch done = new CountDownLatch(1);
608              ScheduledFuture[] tasks = new ScheduledFuture[5];
609              for (int i = 0; i < tasks.length; i++) {
610                  Runnable r = new CheckedRunnable() {
# Line 618 | Line 618 | public class ScheduledExecutorSubclassTe
618              BlockingQueue<Runnable> q = p.getQueue();
619              assertTrue(q.contains(tasks[tasks.length - 1]));
620              assertFalse(q.contains(tasks[0]));
621            done.countDown();
621          }
622      }
623  
# Line 626 | Line 625 | public class ScheduledExecutorSubclassTe
625       * remove(task) removes queued task, and fails to remove active task
626       */
627      public void testRemove() throws InterruptedException {
628 +        final CountDownLatch done = new CountDownLatch(1);
629          final ScheduledThreadPoolExecutor p = new CustomExecutor(1);
630 <        try (PoolCleaner cleaner = cleaner(p)) {
630 >        try (PoolCleaner cleaner = cleaner(p, done)) {
631              ScheduledFuture[] tasks = new ScheduledFuture[5];
632              final CountDownLatch threadStarted = new CountDownLatch(1);
633            final CountDownLatch done = new CountDownLatch(1);
633              for (int i = 0; i < tasks.length; i++) {
634                  Runnable r = new CheckedRunnable() {
635                      public void realRun() throws InterruptedException {
# Line 650 | Line 649 | public class ScheduledExecutorSubclassTe
649              assertTrue(q.contains((Runnable)tasks[3]));
650              assertTrue(p.remove((Runnable)tasks[3]));
651              assertFalse(q.contains((Runnable)tasks[3]));
653            done.countDown();
652          }
653      }
654  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines