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

Comparing jsr166/src/test/tck/ScheduledExecutorTest.java (file contents):
Revision 1.73 by jsr166, Tue Oct 6 06:02:53 2015 UTC vs.
Revision 1.74 by jsr166, Tue Oct 6 16:39:06 2015 UTC

# Line 1168 | Line 1168 | public class ScheduledExecutorTest exten
1168       * timed invokeAll(c) cancels tasks not completed by timeout
1169       */
1170      public void testTimedInvokeAll6() throws Exception {
1171 <        final ExecutorService e = new ScheduledThreadPoolExecutor(2);
1172 <        try (PoolCleaner cleaner = cleaner(e)) {
1173 <            for (long timeout = timeoutMillis();;) {
1171 >        for (long timeout = timeoutMillis();;) {
1172 >            final CountDownLatch done = new CountDownLatch(1);
1173 >            final Callable<String> waiter = new CheckedCallable<String>() {
1174 >                public String realCall() {
1175 >                    try { done.await(LONG_DELAY_MS, MILLISECONDS); }
1176 >                    catch (InterruptedException ok) {}
1177 >                    return "1"; }};
1178 >            final ExecutorService p = new ScheduledThreadPoolExecutor(2);
1179 >            try (PoolCleaner cleaner = cleaner(p, done)) {
1180                  List<Callable<String>> tasks = new ArrayList<>();
1181                  tasks.add(new StringTask("0"));
1182 <                tasks.add(Executors.callable(new LongPossiblyInterruptedRunnable(), TEST_STRING));
1182 >                tasks.add(waiter);
1183                  tasks.add(new StringTask("2"));
1184                  long startTime = System.nanoTime();
1185                  List<Future<String>> futures =
1186 <                    e.invokeAll(tasks, timeout, MILLISECONDS);
1186 >                    p.invokeAll(tasks, timeout, MILLISECONDS);
1187                  assertEquals(tasks.size(), futures.size());
1188                  assertTrue(millisElapsedSince(startTime) >= timeout);
1189                  for (Future future : futures)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines