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.47 by jsr166, Sat Oct 3 18:17:51 2015 UTC vs.
Revision 1.48 by jsr166, Sun Oct 4 00:18:49 2015 UTC

# Line 230 | Line 230 | public class ThreadPoolExecutorSubclassT
230       * execute successfully executes a runnable
231       */
232      public void testExecute() throws InterruptedException {
233 <        final ThreadPoolExecutor p =
234 <            new CustomTPE(1, 1,
235 <                          LONG_DELAY_MS, MILLISECONDS,
236 <                          new ArrayBlockingQueue<Runnable>(10));
237 <        final CountDownLatch done = new CountDownLatch(1);
238 <        final Runnable task = new CheckedRunnable() {
239 <            public void realRun() {
240 <                done.countDown();
241 <            }};
242 <        try {
233 >        try (PoolCloser<CustomTPE> poolCloser = new PoolCloser<>
234 >             (new CustomTPE(1, 1,
235 >                            2 * LONG_DELAY_MS, MILLISECONDS,
236 >                            new ArrayBlockingQueue<Runnable>(10)))) {
237 >            final ThreadPoolExecutor p = poolCloser.pool;
238 >            final CountDownLatch done = new CountDownLatch(1);
239 >            final Runnable task = new CheckedRunnable() {
240 >                public void realRun() { done.countDown();
241 >                }};
242              p.execute(task);
243 <            assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS));
245 <        } finally {
246 <            joinPool(p);
243 >            assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS));
244          }
245      }
246  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines