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.49 by jsr166, Sun Oct 4 00:30:50 2015 UTC vs.
Revision 1.51 by jsr166, Sun Oct 4 00:59:09 2015 UTC

# Line 230 | Line 230 | public class ThreadPoolExecutorSubclassT
230       * execute successfully executes a runnable
231       */
232      public void testExecute() throws InterruptedException {
233 <        try (PoolCleaner<CustomTPE> cleaner =
234 <             cleaner(new CustomTPE(1, 1,
235 <                                   2 * LONG_DELAY_MS, MILLISECONDS,
236 <                                   new ArrayBlockingQueue<Runnable>(10)))) {
237 <            final ThreadPoolExecutor p = cleaner.pool;
233 >        final ThreadPoolExecutor p =
234 >            new CustomTPE(1, 1,
235 >                          2 * LONG_DELAY_MS, MILLISECONDS,
236 >                          new ArrayBlockingQueue<Runnable>(10));
237 >        try (PoolCleaner cleaner = cleaner(p)) {
238              final CountDownLatch done = new CountDownLatch(1);
239              final Runnable task = new CheckedRunnable() {
240 <                public void realRun() { done.countDown();
241 <                }};
240 >                public void realRun() { done.countDown(); }};
241              p.execute(task);
242              assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS));
243          }
# Line 255 | Line 254 | public class ThreadPoolExecutorSubclassT
254                            new ArrayBlockingQueue<Runnable>(10));
255          final CountDownLatch threadStarted = new CountDownLatch(1);
256          final CountDownLatch done = new CountDownLatch(1);
257 <        try {
257 >        try (PoolCleaner cleaner = cleaner(p)) {
258              assertEquals(0, p.getActiveCount());
259              p.execute(new CheckedRunnable() {
260                  public void realRun() throws InterruptedException {
# Line 265 | Line 264 | public class ThreadPoolExecutorSubclassT
264                  }});
265              assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
266              assertEquals(1, p.getActiveCount());
268        } finally {
267              done.countDown();
270            joinPool(p);
268          }
269      }
270  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines