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.92 by jsr166, Tue Oct 6 05:56:01 2015 UTC vs.
Revision 1.93 by jsr166, Tue Oct 6 16:39:06 2015 UTC

# Line 1868 | Line 1868 | public class ThreadPoolExecutorSubclassT
1868       * timed invokeAll(c) cancels tasks not completed by timeout
1869       */
1870      public void testTimedInvokeAll6() throws Exception {
1871 <        final ExecutorService e =
1872 <            new CustomTPE(2, 2,
1873 <                          LONG_DELAY_MS, MILLISECONDS,
1874 <                          new ArrayBlockingQueue<Runnable>(10));
1875 <        try (PoolCleaner cleaner = cleaner(e)) {
1876 <            for (long timeout = timeoutMillis();;) {
1871 >        for (long timeout = timeoutMillis();;) {
1872 >            final CountDownLatch done = new CountDownLatch(1);
1873 >            final Callable<String> waiter = new CheckedCallable<String>() {
1874 >                public String realCall() {
1875 >                    try { done.await(LONG_DELAY_MS, MILLISECONDS); }
1876 >                    catch (InterruptedException ok) {}
1877 >                    return "1"; }};
1878 >            final ExecutorService p =
1879 >                new CustomTPE(2, 2,
1880 >                              LONG_DELAY_MS, MILLISECONDS,
1881 >                              new ArrayBlockingQueue<Runnable>(10));
1882 >            try (PoolCleaner cleaner = cleaner(p, done)) {
1883                  List<Callable<String>> tasks = new ArrayList<>();
1884                  tasks.add(new StringTask("0"));
1885 <                tasks.add(Executors.callable(new LongPossiblyInterruptedRunnable(), TEST_STRING));
1885 >                tasks.add(waiter);
1886                  tasks.add(new StringTask("2"));
1887                  long startTime = System.nanoTime();
1888                  List<Future<String>> futures =
1889 <                    e.invokeAll(tasks, timeout, MILLISECONDS);
1889 >                    p.invokeAll(tasks, timeout, MILLISECONDS);
1890                  assertEquals(tasks.size(), futures.size());
1891                  assertTrue(millisElapsedSince(startTime) >= timeout);
1892                  for (Future future : futures)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines