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.44 by jsr166, Mon Sep 28 21:15:44 2015 UTC vs.
Revision 1.48 by jsr166, Sun Oct 4 00:18:49 2015 UTC

# Line 130 | Line 130 | public class ThreadPoolExecutorSubclassT
130              lock.lock();
131              try {
132                  while (!done) {
133 <                    if (nanos < 0)
133 >                    if (nanos <= 0L)
134                          throw new TimeoutException();
135                      nanos = cond.awaitNanos(nanos);
136                  }
# 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  
# Line 1749 | Line 1746 | public class ThreadPoolExecutorSubclassT
1746              l.add(new StringTask());
1747              l.add(new StringTask());
1748              List<Future<String>> futures =
1749 <                e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1749 >                e.invokeAll(l, LONG_DELAY_MS, MILLISECONDS);
1750              assertEquals(2, futures.size());
1751              for (Future<String> future : futures)
1752                  assertSame(TEST_STRING, future.get());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines