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.64 by jsr166, Sun Oct 4 02:09:57 2015 UTC vs.
Revision 1.67 by jsr166, Sun Oct 4 02:24:49 2015 UTC

# Line 252 | Line 252 | public class ThreadPoolExecutorSubclassT
252              new CustomTPE(2, 2,
253                            LONG_DELAY_MS, MILLISECONDS,
254                            new ArrayBlockingQueue<Runnable>(10));
255        final CountDownLatch threadStarted = new CountDownLatch(1);
256        final CountDownLatch done = new CountDownLatch(1);
255          try (PoolCleaner cleaner = cleaner(p)) {
256 +            final CountDownLatch threadStarted = new CountDownLatch(1);
257 +            final CountDownLatch done = new CountDownLatch(1);
258              assertEquals(0, p.getActiveCount());
259              p.execute(new CheckedRunnable() {
260                  public void realRun() throws InterruptedException {
# Line 262 | Line 262 | public class ThreadPoolExecutorSubclassT
262                      assertEquals(1, p.getActiveCount());
263                      done.await();
264                  }});
265 <            assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
265 >            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
266              assertEquals(1, p.getActiveCount());
267              done.countDown();
268          }
# Line 549 | Line 549 | public class ThreadPoolExecutorSubclassT
549              new CustomTPE(1, 1,
550                            LONG_DELAY_MS, MILLISECONDS,
551                            new ArrayBlockingQueue<Runnable>(10));
552 <        final CountDownLatch threadStarted = new CountDownLatch(1);
553 <        final CountDownLatch done = new CountDownLatch(1);
554 <        try {
552 >        try (PoolCleaner cleaner = cleaner(p)) {
553 >            final CountDownLatch threadStarted = new CountDownLatch(1);
554 >            final CountDownLatch done = new CountDownLatch(1);
555              assertEquals(0, p.getTaskCount());
556              p.execute(new CheckedRunnable() {
557                  public void realRun() throws InterruptedException {
# Line 559 | Line 559 | public class ThreadPoolExecutorSubclassT
559                      assertEquals(1, p.getTaskCount());
560                      done.await();
561                  }});
562 <            assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
562 >            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
563              assertEquals(1, p.getTaskCount());
564        } finally {
564              done.countDown();
566            joinPool(p);
565          }
566      }
567  
# Line 597 | Line 595 | public class ThreadPoolExecutorSubclassT
595                      threadStarted.countDown();
596                      done.await();
597                  }});
598 <            assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
598 >            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
599              assertFalse(p.isTerminating());
600              done.countDown();
601          } finally {
# Line 626 | Line 624 | public class ThreadPoolExecutorSubclassT
624                      threadStarted.countDown();
625                      done.await();
626                  }});
627 <            assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
627 >            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
628              assertFalse(p.isTerminating());
629              done.countDown();
630          } finally {
# Line 661 | Line 659 | public class ThreadPoolExecutorSubclassT
659                  tasks[i] = new FutureTask(task);
660                  p.execute(tasks[i]);
661              }
662 <            assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
662 >            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
663              assertSame(q, p.getQueue());
664              assertFalse(q.contains(tasks[0]));
665              assertTrue(q.contains(tasks[tasks.length - 1]));
# Line 693 | Line 691 | public class ThreadPoolExecutorSubclassT
691                          }};
692                  p.execute(tasks[i]);
693              }
694 <            assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
694 >            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
695              assertFalse(p.remove(tasks[0]));
696              assertTrue(q.contains(tasks[4]));
697              assertTrue(q.contains(tasks[3]));
# Line 732 | Line 730 | public class ThreadPoolExecutorSubclassT
730                  tasks[i] = new FutureTask(task);
731                  p.execute(tasks[i]);
732              }
733 <            assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
733 >            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
734              assertEquals(tasks.length, p.getTaskCount());
735              assertEquals(tasks.length - 1, q.size());
736              assertEquals(1L, p.getActiveCount());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines