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

Comparing jsr166/src/test/tck/ForkJoinPoolTest.java (file contents):
Revision 1.26 by jsr166, Thu Sep 16 00:52:49 2010 UTC vs.
Revision 1.53 by jsr166, Wed Dec 31 16:44:01 2014 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   import junit.framework.*;
# Line 10 | Line 10 | import java.util.Collection;
10   import java.util.List;
11   import java.util.concurrent.Executors;
12   import java.util.concurrent.ExecutorService;
13 import java.util.concurrent.AbstractExecutorService;
13   import java.util.concurrent.CountDownLatch;
14   import java.util.concurrent.Callable;
15   import java.util.concurrent.Future;
16   import java.util.concurrent.ExecutionException;
18 import java.util.concurrent.CancellationException;
17   import java.util.concurrent.RejectedExecutionException;
18   import java.util.concurrent.ForkJoinPool;
19   import java.util.concurrent.ForkJoinTask;
20   import java.util.concurrent.ForkJoinWorkerThread;
21   import java.util.concurrent.RecursiveTask;
22 < import java.util.concurrent.TimeUnit;
22 > import java.util.concurrent.atomic.AtomicBoolean;
23   import java.util.concurrent.locks.ReentrantLock;
24 < import java.security.AccessControlException;
25 < import java.security.Policy;
24 > import static java.util.concurrent.TimeUnit.MILLISECONDS;
25 > import static java.util.concurrent.TimeUnit.NANOSECONDS;
26   import java.security.PrivilegedAction;
27   import java.security.PrivilegedExceptionAction;
28  
# Line 37 | Line 35 | public class ForkJoinPoolTest extends JS
35          return new TestSuite(ForkJoinPoolTest.class);
36      }
37  
38 <    /**
38 >    /*
39       * Testing coverage notes:
40       *
41       * 1. shutdown and related methods are tested via super.joinPool.
# Line 105 | Line 103 | public class ForkJoinPoolTest extends JS
103      static final class FibTask extends RecursiveTask<Integer> {
104          final int number;
105          FibTask(int n) { number = n; }
106 <        public Integer compute() {
106 >        protected Integer compute() {
107              int n = number;
108              if (n <= 1)
109                  return n;
# Line 133 | Line 131 | public class ForkJoinPoolTest extends JS
131              this.locker = locker;
132              this.lock = lock;
133          }
134 <        public Integer compute() {
134 >        protected Integer compute() {
135              int n;
136              LockingFibTask f1 = null;
137              LockingFibTask f2 = null;
# Line 163 | Line 161 | public class ForkJoinPoolTest extends JS
161          try {
162              assertSame(ForkJoinPool.defaultForkJoinWorkerThreadFactory,
163                         p.getFactory());
166            assertTrue(p.isQuiescent());
164              assertFalse(p.getAsyncMode());
165              assertEquals(0, p.getActiveThreadCount());
166              assertEquals(0, p.getStealCount());
# Line 198 | Line 195 | public class ForkJoinPoolTest extends JS
195          } catch (NullPointerException success) {}
196      }
197  
201
198      /**
199       * getParallelism returns size set in constructor
200       */
# Line 226 | Line 222 | public class ForkJoinPoolTest extends JS
222      }
223  
224      /**
225 +     * awaitTermination on a non-shutdown pool times out
226 +     */
227 +    public void testAwaitTermination_timesOut() throws InterruptedException {
228 +        ForkJoinPool p = new ForkJoinPool(1);
229 +        assertFalse(p.isTerminated());
230 +        assertFalse(p.awaitTermination(Long.MIN_VALUE, NANOSECONDS));
231 +        assertFalse(p.awaitTermination(Long.MIN_VALUE, MILLISECONDS));
232 +        assertFalse(p.awaitTermination(-1L, NANOSECONDS));
233 +        assertFalse(p.awaitTermination(-1L, MILLISECONDS));
234 +        assertFalse(p.awaitTermination(0L, NANOSECONDS));
235 +        assertFalse(p.awaitTermination(0L, MILLISECONDS));
236 +        long timeoutNanos = 999999L;
237 +        long startTime = System.nanoTime();
238 +        assertFalse(p.awaitTermination(timeoutNanos, NANOSECONDS));
239 +        assertTrue(System.nanoTime() - startTime >= timeoutNanos);
240 +        assertFalse(p.isTerminated());
241 +        startTime = System.nanoTime();
242 +        long timeoutMillis = timeoutMillis();
243 +        assertFalse(p.awaitTermination(timeoutMillis, MILLISECONDS));
244 +        assertTrue(millisElapsedSince(startTime) >= timeoutMillis);
245 +        assertFalse(p.isTerminated());
246 +        p.shutdown();
247 +        assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
248 +        assertTrue(p.isTerminated());
249 +    }
250 +
251 +    /**
252       * setUncaughtExceptionHandler changes handler for uncaught exceptions.
253       *
254       * Additionally tests: Overriding ForkJoinWorkerThread.onStart
255       * performs its defined action
256       */
257      public void testSetUncaughtExceptionHandler() throws InterruptedException {
258 <        MyHandler eh = new MyHandler();
258 >        final CountDownLatch uehInvoked = new CountDownLatch(1);
259 >        final Thread.UncaughtExceptionHandler eh =
260 >            new Thread.UncaughtExceptionHandler() {
261 >                public void uncaughtException(Thread t, Throwable e) {
262 >                    uehInvoked.countDown();
263 >                }};
264          ForkJoinPool p = new ForkJoinPool(1, new FailingThreadFactory(),
265                                            eh, false);
266          try {
267              assertSame(eh, p.getUncaughtExceptionHandler());
268 <            p.execute(new FailingTask());
269 <            Thread.sleep(MEDIUM_DELAY_MS);
270 <            assertTrue(eh.catches > 0);
268 >            try {
269 >                p.execute(new FibTask(8));
270 >                assertTrue(uehInvoked.await(MEDIUM_DELAY_MS, MILLISECONDS));
271 >            } catch (RejectedExecutionException ok) {
272 >            }
273          } finally {
274 <            p.shutdownNow();
274 >            p.shutdownNow(); // failure might have prevented processing task
275              joinPool(p);
276          }
277      }
278  
279      /**
280 <     * After invoking a single task, isQuiescent is true,
281 <     * queues are empty, threads are not active, and
282 <     * construction parameters continue to hold
280 >     * After invoking a single task, isQuiescent eventually becomes
281 >     * true, at which time queues are empty, threads are not active,
282 >     * the task has completed successfully, and construction
283 >     * parameters continue to hold
284       */
285 <    public void testisQuiescent() throws InterruptedException {
285 >    public void testIsQuiescent() throws Exception {
286          ForkJoinPool p = new ForkJoinPool(2);
287          try {
288 <            p.invoke(new FibTask(20));
288 >            assertTrue(p.isQuiescent());
289 >            long startTime = System.nanoTime();
290 >            FibTask f = new FibTask(20);
291 >            p.invoke(f);
292              assertSame(ForkJoinPool.defaultForkJoinWorkerThreadFactory,
293                         p.getFactory());
294 <            Thread.sleep(MEDIUM_DELAY_MS);
294 >            while (! p.isQuiescent()) {
295 >                if (millisElapsedSince(startTime) > LONG_DELAY_MS)
296 >                    throw new AssertionFailedError("timed out");
297 >                assertFalse(p.getAsyncMode());
298 >                assertFalse(p.isShutdown());
299 >                assertFalse(p.isTerminating());
300 >                assertFalse(p.isTerminated());
301 >                Thread.yield();
302 >            }
303 >
304              assertTrue(p.isQuiescent());
305              assertFalse(p.getAsyncMode());
306              assertEquals(0, p.getActiveThreadCount());
# Line 267 | Line 310 | public class ForkJoinPoolTest extends JS
310              assertFalse(p.isShutdown());
311              assertFalse(p.isTerminating());
312              assertFalse(p.isTerminated());
313 +            assertTrue(f.isDone());
314 +            assertEquals(6765, (int) f.get());
315          } finally {
316              joinPool(p);
317          }
# Line 310 | Line 355 | public class ForkJoinPoolTest extends JS
355          try {
356              ReentrantLock lock = new ReentrantLock();
357              ManagedLocker locker = new ManagedLocker(lock);
358 <            ForkJoinTask<Integer> f = new LockingFibTask(30, locker, lock);
358 >            ForkJoinTask<Integer> f = new LockingFibTask(20, locker, lock);
359              p.execute(f);
360 <            assertEquals(832040, (int) f.get());
360 >            assertEquals(6765, (int) f.get());
361          } finally {
362              p.shutdownNow(); // don't wait out shutdown
363          }
# Line 322 | Line 367 | public class ForkJoinPoolTest extends JS
367       * pollSubmission returns unexecuted submitted task, if present
368       */
369      public void testPollSubmission() {
370 +        final CountDownLatch done = new CountDownLatch(1);
371          SubFJP p = new SubFJP();
372          try {
373 <            ForkJoinTask a = p.submit(new MediumRunnable());
374 <            ForkJoinTask b = p.submit(new MediumRunnable());
375 <            ForkJoinTask c = p.submit(new MediumRunnable());
373 >            ForkJoinTask a = p.submit(awaiter(done));
374 >            ForkJoinTask b = p.submit(awaiter(done));
375 >            ForkJoinTask c = p.submit(awaiter(done));
376              ForkJoinTask r = p.pollSubmission();
377              assertTrue(r == a || r == b || r == c);
378              assertFalse(r.isDone());
379          } finally {
380 +            done.countDown();
381              joinPool(p);
382          }
383      }
# Line 339 | Line 386 | public class ForkJoinPoolTest extends JS
386       * drainTasksTo transfers unexecuted submitted tasks, if present
387       */
388      public void testDrainTasksTo() {
389 +        final CountDownLatch done = new CountDownLatch(1);
390          SubFJP p = new SubFJP();
391          try {
392 <            ForkJoinTask a = p.submit(new MediumRunnable());
393 <            ForkJoinTask b = p.submit(new MediumRunnable());
394 <            ForkJoinTask c = p.submit(new MediumRunnable());
392 >            ForkJoinTask a = p.submit(awaiter(done));
393 >            ForkJoinTask b = p.submit(awaiter(done));
394 >            ForkJoinTask c = p.submit(awaiter(done));
395              ArrayList<ForkJoinTask> al = new ArrayList();
396              p.drainTasksTo(al);
397              assertTrue(al.size() > 0);
# Line 352 | Line 400 | public class ForkJoinPoolTest extends JS
400                  assertFalse(r.isDone());
401              }
402          } finally {
403 +            done.countDown();
404              joinPool(p);
405          }
406      }
407  
359
408      // FJ Versions of AbstractExecutorService tests
409  
410      /**
# Line 365 | Line 413 | public class ForkJoinPoolTest extends JS
413      public void testExecuteRunnable() throws Throwable {
414          ExecutorService e = new ForkJoinPool(1);
415          try {
416 <            TrackedShortRunnable task = new TrackedShortRunnable();
417 <            assertFalse(task.done);
418 <            Future<?> future = e.submit(task);
419 <            future.get();
420 <            assertTrue(task.done);
416 >            final AtomicBoolean done = new AtomicBoolean(false);
417 >            Future<?> future = e.submit(new CheckedRunnable() {
418 >                public void realRun() {
419 >                    done.set(true);
420 >                }});
421 >            assertNull(future.get());
422 >            assertNull(future.get(0, MILLISECONDS));
423 >            assertTrue(done.get());
424 >            assertTrue(future.isDone());
425 >            assertFalse(future.isCancelled());
426          } finally {
427              joinPool(e);
428          }
429      }
430  
378
431      /**
432       * Completed submit(callable) returns result
433       */
# Line 383 | Line 435 | public class ForkJoinPoolTest extends JS
435          ExecutorService e = new ForkJoinPool(1);
436          try {
437              Future<String> future = e.submit(new StringTask());
438 <            String result = future.get();
439 <            assertSame(TEST_STRING, result);
438 >            assertSame(TEST_STRING, future.get());
439 >            assertTrue(future.isDone());
440 >            assertFalse(future.isCancelled());
441          } finally {
442              joinPool(e);
443          }
# Line 397 | Line 450 | public class ForkJoinPoolTest extends JS
450          ExecutorService e = new ForkJoinPool(1);
451          try {
452              Future<?> future = e.submit(new NoOpRunnable());
453 <            future.get();
453 >            assertNull(future.get());
454              assertTrue(future.isDone());
455 +            assertFalse(future.isCancelled());
456          } finally {
457              joinPool(e);
458          }
# Line 411 | Line 465 | public class ForkJoinPoolTest extends JS
465          ExecutorService e = new ForkJoinPool(1);
466          try {
467              Future<String> future = e.submit(new NoOpRunnable(), TEST_STRING);
468 <            String result = future.get();
469 <            assertSame(TEST_STRING, result);
468 >            assertSame(TEST_STRING, future.get());
469 >            assertTrue(future.isDone());
470 >            assertFalse(future.isCancelled());
471          } finally {
472              joinPool(e);
473          }
474      }
475  
421
476      /**
477 <     * A submitted privileged action to completion
477 >     * A submitted privileged action runs to completion
478       */
479 <    public void testSubmitPrivilegedAction() throws Throwable {
480 <        Policy savedPolicy = null;
481 <        try {
482 <            savedPolicy = Policy.getPolicy();
483 <            AdjustablePolicy policy = new AdjustablePolicy();
430 <            policy.addPermission(new RuntimePermission("getContextClassLoader"));
431 <            policy.addPermission(new RuntimePermission("setContextClassLoader"));
432 <            Policy.setPolicy(policy);
433 <        } catch (AccessControlException ok) {
434 <            return;
435 <        }
436 <
437 <        try {
479 >    public void testSubmitPrivilegedAction() throws Exception {
480 >        final Callable callable = Executors.callable(new PrivilegedAction() {
481 >                public Object run() { return TEST_STRING; }});
482 >        Runnable r = new CheckedRunnable() {
483 >        public void realRun() throws Exception {
484              ExecutorService e = new ForkJoinPool(1);
485              try {
486 <                Future future = e.submit(Executors.callable(new PrivilegedAction() {
487 <                    public Object run() {
442 <                        return TEST_STRING;
443 <                    }}));
444 <
445 <                Object result = future.get();
446 <                assertSame(TEST_STRING, result);
486 >                Future future = e.submit(callable);
487 >                assertSame(TEST_STRING, future.get());
488              } finally {
489                  joinPool(e);
490              }
491 <        } finally {
492 <            Policy.setPolicy(savedPolicy);
493 <        }
491 >        }};
492 >
493 >        runWithPermissions(r, new RuntimePermission("modifyThread"));
494      }
495  
496      /**
497 <     * A submitted a privileged exception action runs to completion
497 >     * A submitted privileged exception action runs to completion
498       */
499 <    public void testSubmitPrivilegedExceptionAction() throws Throwable {
500 <        Policy savedPolicy = null;
501 <        try {
502 <            savedPolicy = Policy.getPolicy();
503 <            AdjustablePolicy policy = new AdjustablePolicy();
504 <            policy.addPermission(new RuntimePermission("getContextClassLoader"));
464 <            policy.addPermission(new RuntimePermission("setContextClassLoader"));
465 <            Policy.setPolicy(policy);
466 <        } catch (AccessControlException ok) {
467 <            return;
468 <        }
469 <
470 <        try {
499 >    public void testSubmitPrivilegedExceptionAction() throws Exception {
500 >        final Callable callable =
501 >            Executors.callable(new PrivilegedExceptionAction() {
502 >                public Object run() { return TEST_STRING; }});
503 >        Runnable r = new CheckedRunnable() {
504 >        public void realRun() throws Exception {
505              ExecutorService e = new ForkJoinPool(1);
506              try {
507 <                Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() {
508 <                    public Object run() {
475 <                        return TEST_STRING;
476 <                    }}));
477 <
478 <                Object result = future.get();
479 <                assertSame(TEST_STRING, result);
507 >                Future future = e.submit(callable);
508 >                assertSame(TEST_STRING, future.get());
509              } finally {
510                  joinPool(e);
511              }
512 <        } finally {
513 <            Policy.setPolicy(savedPolicy);
514 <        }
512 >        }};
513 >
514 >        runWithPermissions(r, new RuntimePermission("modifyThread"));
515      }
516  
517      /**
518       * A submitted failed privileged exception action reports exception
519       */
520 <    public void testSubmitFailedPrivilegedExceptionAction() throws Throwable {
521 <        Policy savedPolicy = null;
522 <        try {
523 <            savedPolicy = Policy.getPolicy();
524 <            AdjustablePolicy policy = new AdjustablePolicy();
525 <            policy.addPermission(new RuntimePermission("getContextClassLoader"));
497 <            policy.addPermission(new RuntimePermission("setContextClassLoader"));
498 <            Policy.setPolicy(policy);
499 <        } catch (AccessControlException ok) {
500 <            return;
501 <        }
502 <
503 <        try {
520 >    public void testSubmitFailedPrivilegedExceptionAction() throws Exception {
521 >        final Callable callable =
522 >            Executors.callable(new PrivilegedExceptionAction() {
523 >                public Object run() { throw new IndexOutOfBoundsException(); }});
524 >        Runnable r = new CheckedRunnable() {
525 >        public void realRun() throws Exception {
526              ExecutorService e = new ForkJoinPool(1);
527              try {
528 <                Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() {
529 <                    public Object run() throws Exception {
530 <                        throw new IndexOutOfBoundsException();
531 <                    }}));
532 <
533 <                Object result = future.get();
534 <                shouldThrow();
513 <            } catch (ExecutionException success) {
514 <                assertTrue(success.getCause() instanceof IndexOutOfBoundsException);
528 >                Future future = e.submit(callable);
529 >                try {
530 >                    future.get();
531 >                    shouldThrow();
532 >                } catch (ExecutionException success) {
533 >                    assertTrue(success.getCause() instanceof IndexOutOfBoundsException);
534 >                }
535              } finally {
536                  joinPool(e);
537              }
538 <        } finally {
539 <            Policy.setPolicy(savedPolicy);
540 <        }
538 >        }};
539 >
540 >        runWithPermissions(r, new RuntimePermission("modifyThread"));
541      }
542  
543      /**
# Line 525 | Line 545 | public class ForkJoinPoolTest extends JS
545       */
546      public void testExecuteNullRunnable() {
547          ExecutorService e = new ForkJoinPool(1);
528        TrackedShortRunnable task = null;
548          try {
549 <            Future<?> future = e.submit(task);
549 >            Future<?> future = e.submit((Runnable) null);
550              shouldThrow();
551          } catch (NullPointerException success) {
552          } finally {
# Line 535 | Line 554 | public class ForkJoinPoolTest extends JS
554          }
555      }
556  
538
557      /**
558       * submit(null callable) throws NullPointerException
559       */
560      public void testSubmitNullCallable() {
561          ExecutorService e = new ForkJoinPool(1);
544        StringTask t = null;
562          try {
563 <            Future<String> future = e.submit(t);
563 >            Future<String> future = e.submit((Callable) null);
564              shouldThrow();
565          } catch (NullPointerException success) {
566          } finally {
# Line 551 | Line 568 | public class ForkJoinPoolTest extends JS
568          }
569      }
570  
554
571      /**
572 <     * Blocking on submit(callable) throws InterruptedException if
557 <     * caller interrupted.
572 >     * submit(callable).get() throws InterruptedException if interrupted
573       */
574      public void testInterruptedSubmit() throws InterruptedException {
575 <        final ForkJoinPool p = new ForkJoinPool(1);
576 <
577 <        Thread t = new Thread(new CheckedInterruptedRunnable() {
578 <            public void realRun() throws Throwable {
579 <                p.submit(new CheckedCallable<Object>() {
580 <                    public Object realCall() throws Throwable {
581 <                        try {
582 <                            Thread.sleep(MEDIUM_DELAY_MS);
583 <                        } catch (InterruptedException ok) {
584 <                        }
585 <                        return null;
586 <                    }}).get();
587 <            }});
588 <
589 <        t.start();
590 <        Thread.sleep(SHORT_DELAY_MS);
591 <        t.interrupt();
592 <        t.join();
593 <        p.shutdownNow();
594 <        joinPool(p);
575 >        final CountDownLatch submitted    = new CountDownLatch(1);
576 >        final CountDownLatch quittingTime = new CountDownLatch(1);
577 >        final ExecutorService p = new ForkJoinPool(1);
578 >        final Callable<Void> awaiter = new CheckedCallable<Void>() {
579 >            public Void realCall() throws InterruptedException {
580 >                assertTrue(quittingTime.await(MEDIUM_DELAY_MS, MILLISECONDS));
581 >                return null;
582 >            }};
583 >        try {
584 >            Thread t = new Thread(new CheckedInterruptedRunnable() {
585 >                public void realRun() throws Exception {
586 >                    Future<Void> future = p.submit(awaiter);
587 >                    submitted.countDown();
588 >                    future.get();
589 >                }});
590 >            t.start();
591 >            assertTrue(submitted.await(MEDIUM_DELAY_MS, MILLISECONDS));
592 >            t.interrupt();
593 >            t.join();
594 >        } finally {
595 >            quittingTime.countDown();
596 >            joinPool(p);
597 >        }
598      }
599  
600      /**
# Line 587 | Line 605 | public class ForkJoinPoolTest extends JS
605          ForkJoinPool p = new ForkJoinPool(1);
606          try {
607              p.submit(new Callable() {
608 <                public Object call() {
609 <                    int i = 5/0;
592 <                    return Boolean.TRUE;
593 <                }}).get();
608 >                public Object call() { throw new ArithmeticException(); }})
609 >                .get();
610              shouldThrow();
611          } catch (ExecutionException success) {
612              assertTrue(success.getCause() instanceof ArithmeticException);
# Line 778 | Line 794 | public class ForkJoinPoolTest extends JS
794          }
795      }
796  
781
797      /**
798       * timed invokeAny(null) throws NullPointerException
799       */
800      public void testTimedInvokeAny1() throws Throwable {
801          ExecutorService e = new ForkJoinPool(1);
802          try {
803 <            e.invokeAny(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
803 >            e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS);
804              shouldThrow();
805          } catch (NullPointerException success) {
806          } finally {
# Line 816 | Line 831 | public class ForkJoinPoolTest extends JS
831          ExecutorService e = new ForkJoinPool(1);
832          try {
833              e.invokeAny(new ArrayList<Callable<String>>(),
834 <                        MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
834 >                        MEDIUM_DELAY_MS, MILLISECONDS);
835              shouldThrow();
836          } catch (IllegalArgumentException success) {
837          } finally {
# Line 834 | Line 849 | public class ForkJoinPoolTest extends JS
849          l.add(latchAwaitingStringTask(latch));
850          l.add(null);
851          try {
852 <            e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
852 >            e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
853              shouldThrow();
854          } catch (NullPointerException success) {
855          } finally {
# Line 851 | Line 866 | public class ForkJoinPoolTest extends JS
866          List<Callable<String>> l = new ArrayList<Callable<String>>();
867          l.add(new NPETask());
868          try {
869 <            e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
869 >            e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
870              shouldThrow();
871          } catch (ExecutionException success) {
872              assertTrue(success.getCause() instanceof NullPointerException);
# Line 869 | Line 884 | public class ForkJoinPoolTest extends JS
884              List<Callable<String>> l = new ArrayList<Callable<String>>();
885              l.add(new StringTask());
886              l.add(new StringTask());
887 <            String result = e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
887 >            String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
888              assertSame(TEST_STRING, result);
889          } finally {
890              joinPool(e);
# Line 882 | Line 897 | public class ForkJoinPoolTest extends JS
897      public void testTimedInvokeAll1() throws Throwable {
898          ExecutorService e = new ForkJoinPool(1);
899          try {
900 <            e.invokeAll(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
900 >            e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS);
901              shouldThrow();
902          } catch (NullPointerException success) {
903          } finally {
# Line 914 | Line 929 | public class ForkJoinPoolTest extends JS
929          try {
930              List<Future<String>> r
931                  = e.invokeAll(new ArrayList<Callable<String>>(),
932 <                              MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
932 >                              MEDIUM_DELAY_MS, MILLISECONDS);
933              assertTrue(r.isEmpty());
934          } finally {
935              joinPool(e);
# Line 930 | Line 945 | public class ForkJoinPoolTest extends JS
945          l.add(new StringTask());
946          l.add(null);
947          try {
948 <            e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
948 >            e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
949              shouldThrow();
950          } catch (NullPointerException success) {
951          } finally {
# Line 946 | Line 961 | public class ForkJoinPoolTest extends JS
961          List<Callable<String>> l = new ArrayList<Callable<String>>();
962          l.add(new NPETask());
963          List<Future<String>> futures
964 <            = e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
964 >            = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
965          assertEquals(1, futures.size());
966          try {
967              futures.get(0).get();
# Line 968 | Line 983 | public class ForkJoinPoolTest extends JS
983              l.add(new StringTask());
984              l.add(new StringTask());
985              List<Future<String>> futures
986 <                = e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
986 >                = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
987              assertEquals(2, futures.size());
988              for (Future<String> future : futures)
989                  assertSame(TEST_STRING, future.get());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines