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.25 by jsr166, Mon Sep 13 20:48:58 2010 UTC vs.
Revision 1.49 by jsr166, Sat Feb 16 20:50:29 2013 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 22 | Line 22 | import java.util.concurrent.ForkJoinTask
22   import java.util.concurrent.ForkJoinWorkerThread;
23   import java.util.concurrent.RecursiveTask;
24   import java.util.concurrent.TimeUnit;
25 + import java.util.concurrent.atomic.AtomicBoolean;
26   import java.util.concurrent.locks.ReentrantLock;
27 + import static java.util.concurrent.TimeUnit.MILLISECONDS;
28   import java.security.AccessControlException;
29   import java.security.Policy;
30   import java.security.PrivilegedAction;
# Line 37 | Line 39 | public class ForkJoinPoolTest extends JS
39          return new TestSuite(ForkJoinPoolTest.class);
40      }
41  
42 <    /**
42 >    /*
43       * Testing coverage notes:
44       *
45       * 1. shutdown and related methods are tested via super.joinPool.
# Line 161 | Line 163 | public class ForkJoinPoolTest extends JS
163      public void testDefaultInitialState() {
164          ForkJoinPool p = new ForkJoinPool(1);
165          try {
166 <            assertTrue(p.getFactory() ==
167 <                       ForkJoinPool.defaultForkJoinWorkerThreadFactory);
166 <            assertTrue(p.isQuiescent());
166 >            assertSame(ForkJoinPool.defaultForkJoinWorkerThreadFactory,
167 >                       p.getFactory());
168              assertFalse(p.getAsyncMode());
169 <            assertTrue(p.getActiveThreadCount() == 0);
170 <            assertTrue(p.getStealCount() == 0);
171 <            assertTrue(p.getQueuedTaskCount() == 0);
172 <            assertTrue(p.getQueuedSubmissionCount() == 0);
169 >            assertEquals(0, p.getActiveThreadCount());
170 >            assertEquals(0, p.getStealCount());
171 >            assertEquals(0, p.getQueuedTaskCount());
172 >            assertEquals(0, p.getQueuedSubmissionCount());
173              assertFalse(p.hasQueuedSubmissions());
174              assertFalse(p.isShutdown());
175              assertFalse(p.isTerminating());
# Line 198 | Line 199 | public class ForkJoinPoolTest extends JS
199          } catch (NullPointerException success) {}
200      }
201  
201
202      /**
203       * getParallelism returns size set in constructor
204       */
205      public void testGetParallelism() {
206          ForkJoinPool p = new ForkJoinPool(1);
207          try {
208 <            assertTrue(p.getParallelism() == 1);
208 >            assertEquals(1, p.getParallelism());
209          } finally {
210              joinPool(p);
211          }
# Line 217 | Line 217 | public class ForkJoinPoolTest extends JS
217      public void testGetPoolSize() {
218          ForkJoinPool p = new ForkJoinPool(1);
219          try {
220 <            assertTrue(p.getActiveThreadCount() == 0);
220 >            assertEquals(0, p.getActiveThreadCount());
221              Future<String> future = p.submit(new StringTask());
222 <            assertTrue(p.getPoolSize() == 1);
222 >            assertEquals(1, p.getPoolSize());
223          } finally {
224              joinPool(p);
225          }
# Line 232 | Line 232 | public class ForkJoinPoolTest extends JS
232       * performs its defined action
233       */
234      public void testSetUncaughtExceptionHandler() throws InterruptedException {
235 <        MyHandler eh = new MyHandler();
236 <        ForkJoinPool p = new ForkJoinPool(1, new FailingThreadFactory(), eh, false);
235 >        final CountDownLatch uehInvoked = new CountDownLatch(1);
236 >        final Thread.UncaughtExceptionHandler eh =
237 >            new Thread.UncaughtExceptionHandler() {
238 >                public void uncaughtException(Thread t, Throwable e) {
239 >                    uehInvoked.countDown();
240 >                }};
241 >        ForkJoinPool p = new ForkJoinPool(1, new FailingThreadFactory(),
242 >                                          eh, false);
243          try {
244 <            assert(eh == p.getUncaughtExceptionHandler());
245 <            p.execute(new FailingTask());
246 <            Thread.sleep(MEDIUM_DELAY_MS);
247 <            assertTrue(eh.catches > 0);
244 >            assertSame(eh, p.getUncaughtExceptionHandler());
245 >            try {
246 >                p.execute(new FibTask(8));
247 >                assertTrue(uehInvoked.await(MEDIUM_DELAY_MS, MILLISECONDS));
248 >            } catch (RejectedExecutionException ok) {
249 >            }
250          } finally {
251 <            p.shutdownNow();
251 >            p.shutdownNow(); // failure might have prevented processing task
252              joinPool(p);
253          }
254      }
255  
256      /**
257 <     * After invoking a single task, isQuiescent is true,
258 <     * queues are empty, threads are not active, and
259 <     * construction parameters continue to hold
257 >     * After invoking a single task, isQuiescent eventually becomes
258 >     * true, at which time queues are empty, threads are not active,
259 >     * the task has completed successfully, and construction
260 >     * parameters continue to hold
261       */
262 <    public void testisQuiescent() throws InterruptedException {
262 >    public void testIsQuiescent() throws Exception {
263          ForkJoinPool p = new ForkJoinPool(2);
264          try {
265 <            p.invoke(new FibTask(20));
266 <            assertTrue(p.getFactory() ==
267 <                       ForkJoinPool.defaultForkJoinWorkerThreadFactory);
268 <            Thread.sleep(MEDIUM_DELAY_MS);
265 >            assertTrue(p.isQuiescent());
266 >            long startTime = System.nanoTime();
267 >            FibTask f = new FibTask(20);
268 >            p.invoke(f);
269 >            assertSame(ForkJoinPool.defaultForkJoinWorkerThreadFactory,
270 >                       p.getFactory());
271 >            while (! p.isQuiescent()) {
272 >                if (millisElapsedSince(startTime) > LONG_DELAY_MS)
273 >                    throw new AssertionFailedError("timed out");
274 >                assertFalse(p.getAsyncMode());
275 >                assertFalse(p.isShutdown());
276 >                assertFalse(p.isTerminating());
277 >                assertFalse(p.isTerminated());
278 >                Thread.yield();
279 >            }
280 >
281              assertTrue(p.isQuiescent());
282              assertFalse(p.getAsyncMode());
283 <            assertTrue(p.getActiveThreadCount() == 0);
284 <            assertTrue(p.getQueuedTaskCount() == 0);
285 <            assertTrue(p.getQueuedSubmissionCount() == 0);
283 >            assertEquals(0, p.getActiveThreadCount());
284 >            assertEquals(0, p.getQueuedTaskCount());
285 >            assertEquals(0, p.getQueuedSubmissionCount());
286              assertFalse(p.hasQueuedSubmissions());
287              assertFalse(p.isShutdown());
288              assertFalse(p.isTerminating());
289              assertFalse(p.isTerminated());
290 +            assertTrue(f.isDone());
291 +            assertEquals(6765, (int) f.get());
292          } finally {
293              joinPool(p);
294          }
# Line 278 | Line 301 | public class ForkJoinPoolTest extends JS
301          ForkJoinPool p = new ForkJoinPool(1);
302          try {
303              ForkJoinTask<Integer> f = p.submit(new FibTask(8));
304 <            int r = f.get();
282 <            assertTrue(r == 21);
304 >            assertEquals(21, (int) f.get());
305          } finally {
306              joinPool(p);
307          }
# Line 293 | Line 315 | public class ForkJoinPoolTest extends JS
315          try {
316              p.shutdown();
317              assertTrue(p.isShutdown());
318 <            ForkJoinTask<Integer> f = p.submit(new FibTask(8));
319 <            shouldThrow();
320 <        } catch (RejectedExecutionException success) {
318 >            try {
319 >                ForkJoinTask<Integer> f = p.submit(new FibTask(8));
320 >                shouldThrow();
321 >            } catch (RejectedExecutionException success) {}
322          } finally {
323              joinPool(p);
324          }
# Line 309 | Line 332 | public class ForkJoinPoolTest extends JS
332          try {
333              ReentrantLock lock = new ReentrantLock();
334              ManagedLocker locker = new ManagedLocker(lock);
335 <            ForkJoinTask<Integer> f = new LockingFibTask(30, locker, lock);
335 >            ForkJoinTask<Integer> f = new LockingFibTask(20, locker, lock);
336              p.execute(f);
337 <            int r = f.get();
315 <            assertTrue(r == 832040);
337 >            assertEquals(6765, (int) f.get());
338          } finally {
339              p.shutdownNow(); // don't wait out shutdown
340          }
# Line 322 | Line 344 | public class ForkJoinPoolTest extends JS
344       * pollSubmission returns unexecuted submitted task, if present
345       */
346      public void testPollSubmission() {
347 +        final CountDownLatch done = new CountDownLatch(1);
348          SubFJP p = new SubFJP();
349          try {
350 <            ForkJoinTask a = p.submit(new MediumRunnable());
351 <            ForkJoinTask b = p.submit(new MediumRunnable());
352 <            ForkJoinTask c = p.submit(new MediumRunnable());
350 >            ForkJoinTask a = p.submit(awaiter(done));
351 >            ForkJoinTask b = p.submit(awaiter(done));
352 >            ForkJoinTask c = p.submit(awaiter(done));
353              ForkJoinTask r = p.pollSubmission();
354              assertTrue(r == a || r == b || r == c);
355              assertFalse(r.isDone());
356          } finally {
357 +            done.countDown();
358              joinPool(p);
359          }
360      }
# Line 339 | Line 363 | public class ForkJoinPoolTest extends JS
363       * drainTasksTo transfers unexecuted submitted tasks, if present
364       */
365      public void testDrainTasksTo() {
366 +        final CountDownLatch done = new CountDownLatch(1);
367          SubFJP p = new SubFJP();
368          try {
369 <            ForkJoinTask a = p.submit(new MediumRunnable());
370 <            ForkJoinTask b = p.submit(new MediumRunnable());
371 <            ForkJoinTask c = p.submit(new MediumRunnable());
369 >            ForkJoinTask a = p.submit(awaiter(done));
370 >            ForkJoinTask b = p.submit(awaiter(done));
371 >            ForkJoinTask c = p.submit(awaiter(done));
372              ArrayList<ForkJoinTask> al = new ArrayList();
373              p.drainTasksTo(al);
374              assertTrue(al.size() > 0);
# Line 352 | Line 377 | public class ForkJoinPoolTest extends JS
377                  assertFalse(r.isDone());
378              }
379          } finally {
380 +            done.countDown();
381              joinPool(p);
382          }
383      }
384  
359
385      // FJ Versions of AbstractExecutorService tests
386  
387      /**
# Line 365 | Line 390 | public class ForkJoinPoolTest extends JS
390      public void testExecuteRunnable() throws Throwable {
391          ExecutorService e = new ForkJoinPool(1);
392          try {
393 <            TrackedShortRunnable task = new TrackedShortRunnable();
394 <            assertFalse(task.done);
393 >            final AtomicBoolean done = new AtomicBoolean(false);
394 >            CheckedRunnable task = new CheckedRunnable() {
395 >                public void realRun() {
396 >                    done.set(true);
397 >                }};
398              Future<?> future = e.submit(task);
399 <            future.get();
400 <            assertTrue(task.done);
399 >            assertNull(future.get());
400 >            assertNull(future.get(0, MILLISECONDS));
401 >            assertTrue(done.get());
402 >            assertTrue(future.isDone());
403 >            assertFalse(future.isCancelled());
404          } finally {
405              joinPool(e);
406          }
407      }
408  
378
409      /**
410       * Completed submit(callable) returns result
411       */
# Line 383 | Line 413 | public class ForkJoinPoolTest extends JS
413          ExecutorService e = new ForkJoinPool(1);
414          try {
415              Future<String> future = e.submit(new StringTask());
416 <            String result = future.get();
417 <            assertSame(TEST_STRING, result);
416 >            assertSame(TEST_STRING, future.get());
417 >            assertTrue(future.isDone());
418 >            assertFalse(future.isCancelled());
419          } finally {
420              joinPool(e);
421          }
# Line 397 | Line 428 | public class ForkJoinPoolTest extends JS
428          ExecutorService e = new ForkJoinPool(1);
429          try {
430              Future<?> future = e.submit(new NoOpRunnable());
431 <            future.get();
431 >            assertNull(future.get());
432              assertTrue(future.isDone());
433 +            assertFalse(future.isCancelled());
434          } finally {
435              joinPool(e);
436          }
# Line 411 | Line 443 | public class ForkJoinPoolTest extends JS
443          ExecutorService e = new ForkJoinPool(1);
444          try {
445              Future<String> future = e.submit(new NoOpRunnable(), TEST_STRING);
446 <            String result = future.get();
447 <            assertSame(TEST_STRING, result);
446 >            assertSame(TEST_STRING, future.get());
447 >            assertTrue(future.isDone());
448 >            assertFalse(future.isCancelled());
449          } finally {
450              joinPool(e);
451          }
452      }
453  
421
454      /**
455 <     * A submitted privileged action to completion
455 >     * A submitted privileged action runs to completion
456       */
457 <    public void testSubmitPrivilegedAction() throws Throwable {
458 <        Policy savedPolicy = null;
459 <        try {
460 <            savedPolicy = Policy.getPolicy();
461 <            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 {
457 >    public void testSubmitPrivilegedAction() throws Exception {
458 >        final Callable callable = Executors.callable(new PrivilegedAction() {
459 >                public Object run() { return TEST_STRING; }});
460 >        Runnable r = new CheckedRunnable() {
461 >        public void realRun() throws Exception {
462              ExecutorService e = new ForkJoinPool(1);
463              try {
464 <                Future future = e.submit(Executors.callable(new PrivilegedAction() {
465 <                    public Object run() {
442 <                        return TEST_STRING;
443 <                    }}));
444 <
445 <                Object result = future.get();
446 <                assertSame(TEST_STRING, result);
464 >                Future future = e.submit(callable);
465 >                assertSame(TEST_STRING, future.get());
466              } finally {
467                  joinPool(e);
468              }
469 <        } finally {
470 <            Policy.setPolicy(savedPolicy);
471 <        }
469 >        }};
470 >
471 >        runWithPermissions(r, new RuntimePermission("modifyThread"));
472      }
473  
474      /**
475 <     * A submitted a privileged exception action runs to completion
475 >     * A submitted privileged exception action runs to completion
476       */
477 <    public void testSubmitPrivilegedExceptionAction() throws Throwable {
478 <        Policy savedPolicy = null;
479 <        try {
480 <            savedPolicy = Policy.getPolicy();
481 <            AdjustablePolicy policy = new AdjustablePolicy();
482 <            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 {
477 >    public void testSubmitPrivilegedExceptionAction() throws Exception {
478 >        final Callable callable =
479 >            Executors.callable(new PrivilegedExceptionAction() {
480 >                public Object run() { return TEST_STRING; }});
481 >        Runnable r = new CheckedRunnable() {
482 >        public void realRun() throws Exception {
483              ExecutorService e = new ForkJoinPool(1);
484              try {
485 <                Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() {
486 <                    public Object run() {
475 <                        return TEST_STRING;
476 <                    }}));
477 <
478 <                Object result = future.get();
479 <                assertSame(TEST_STRING, result);
485 >                Future future = e.submit(callable);
486 >                assertSame(TEST_STRING, future.get());
487              } finally {
488                  joinPool(e);
489              }
490 <        } finally {
491 <            Policy.setPolicy(savedPolicy);
492 <        }
490 >        }};
491 >
492 >        runWithPermissions(r, new RuntimePermission("modifyThread"));
493      }
494  
495      /**
496       * A submitted failed privileged exception action reports exception
497       */
498 <    public void testSubmitFailedPrivilegedExceptionAction() throws Throwable {
499 <        Policy savedPolicy = null;
500 <        try {
501 <            savedPolicy = Policy.getPolicy();
502 <            AdjustablePolicy policy = new AdjustablePolicy();
503 <            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 {
498 >    public void testSubmitFailedPrivilegedExceptionAction() throws Exception {
499 >        final Callable callable =
500 >            Executors.callable(new PrivilegedExceptionAction() {
501 >                public Object run() { throw new IndexOutOfBoundsException(); }});
502 >        Runnable r = new CheckedRunnable() {
503 >        public void realRun() throws Exception {
504              ExecutorService e = new ForkJoinPool(1);
505              try {
506 <                Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() {
507 <                    public Object run() throws Exception {
508 <                        throw new IndexOutOfBoundsException();
509 <                    }}));
510 <
511 <                Object result = future.get();
512 <                shouldThrow();
513 <            } catch (ExecutionException success) {
514 <                assertTrue(success.getCause() instanceof IndexOutOfBoundsException);
506 >                Future future = e.submit(callable);
507 >                try {
508 >                    future.get();
509 >                    shouldThrow();
510 >                } catch (ExecutionException success) {
511 >                    assertTrue(success.getCause() instanceof IndexOutOfBoundsException);
512 >                }
513              } finally {
514                  joinPool(e);
515              }
516 <        } finally {
517 <            Policy.setPolicy(savedPolicy);
518 <        }
516 >        }};
517 >
518 >        runWithPermissions(r, new RuntimePermission("modifyThread"));
519      }
520  
521      /**
# Line 526 | Line 524 | public class ForkJoinPoolTest extends JS
524      public void testExecuteNullRunnable() {
525          ExecutorService e = new ForkJoinPool(1);
526          try {
527 <            TrackedShortRunnable task = null;
530 <            Future<?> future = e.submit(task);
527 >            Future<?> future = e.submit((Runnable) null);
528              shouldThrow();
529          } catch (NullPointerException success) {
530          } finally {
# Line 535 | Line 532 | public class ForkJoinPoolTest extends JS
532          }
533      }
534  
538
535      /**
536       * submit(null callable) throws NullPointerException
537       */
538      public void testSubmitNullCallable() {
539          ExecutorService e = new ForkJoinPool(1);
540          try {
541 <            StringTask t = null;
546 <            Future<String> future = e.submit(t);
541 >            Future<String> future = e.submit((Callable) null);
542              shouldThrow();
543          } catch (NullPointerException success) {
544          } finally {
# Line 551 | Line 546 | public class ForkJoinPoolTest extends JS
546          }
547      }
548  
554
549      /**
550 <     * Blocking on submit(callable) throws InterruptedException if
557 <     * caller interrupted.
550 >     * submit(callable).get() throws InterruptedException if interrupted
551       */
552      public void testInterruptedSubmit() throws InterruptedException {
553 <        final ForkJoinPool p = new ForkJoinPool(1);
554 <
555 <        Thread t = new Thread(new CheckedInterruptedRunnable() {
556 <            public void realRun() throws Throwable {
557 <                p.submit(new CheckedCallable<Object>() {
558 <                    public Object realCall() throws Throwable {
559 <                        try {
560 <                            Thread.sleep(MEDIUM_DELAY_MS);
561 <                        } catch (InterruptedException ok) {
562 <                        }
563 <                        return null;
564 <                    }}).get();
565 <            }});
566 <
567 <        t.start();
568 <        Thread.sleep(SHORT_DELAY_MS);
569 <        t.interrupt();
570 <        t.join();
571 <        p.shutdownNow();
572 <        joinPool(p);
553 >        final CountDownLatch submitted    = new CountDownLatch(1);
554 >        final CountDownLatch quittingTime = new CountDownLatch(1);
555 >        final ExecutorService p = new ForkJoinPool(1);
556 >        final Callable<Void> awaiter = new CheckedCallable<Void>() {
557 >            public Void realCall() throws InterruptedException {
558 >                assertTrue(quittingTime.await(MEDIUM_DELAY_MS, MILLISECONDS));
559 >                return null;
560 >            }};
561 >        try {
562 >            Thread t = new Thread(new CheckedInterruptedRunnable() {
563 >                public void realRun() throws Exception {
564 >                    Future<Void> future = p.submit(awaiter);
565 >                    submitted.countDown();
566 >                    future.get();
567 >                }});
568 >            t.start();
569 >            assertTrue(submitted.await(MEDIUM_DELAY_MS, MILLISECONDS));
570 >            t.interrupt();
571 >            t.join();
572 >        } finally {
573 >            quittingTime.countDown();
574 >            joinPool(p);
575 >        }
576      }
577  
578      /**
# Line 587 | Line 583 | public class ForkJoinPoolTest extends JS
583          ForkJoinPool p = new ForkJoinPool(1);
584          try {
585              p.submit(new Callable() {
586 <                public Object call() {
587 <                    int i = 5/0;
592 <                    return Boolean.TRUE;
593 <                }}).get();
586 >                public Object call() { throw new ArithmeticException(); }})
587 >                .get();
588              shouldThrow();
589          } catch (ExecutionException success) {
590              assertTrue(success.getCause() instanceof ArithmeticException);
# Line 778 | Line 772 | public class ForkJoinPoolTest extends JS
772          }
773      }
774  
781
775      /**
776       * timed invokeAny(null) throws NullPointerException
777       */
778      public void testTimedInvokeAny1() throws Throwable {
779          ExecutorService e = new ForkJoinPool(1);
780          try {
781 <            e.invokeAny(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
781 >            e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS);
782              shouldThrow();
783          } catch (NullPointerException success) {
784          } finally {
# Line 816 | Line 809 | public class ForkJoinPoolTest extends JS
809          ExecutorService e = new ForkJoinPool(1);
810          try {
811              e.invokeAny(new ArrayList<Callable<String>>(),
812 <                        MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
812 >                        MEDIUM_DELAY_MS, MILLISECONDS);
813              shouldThrow();
814          } catch (IllegalArgumentException success) {
815          } finally {
# Line 834 | Line 827 | public class ForkJoinPoolTest extends JS
827          l.add(latchAwaitingStringTask(latch));
828          l.add(null);
829          try {
830 <            e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
830 >            e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
831              shouldThrow();
832          } catch (NullPointerException success) {
833          } finally {
# Line 851 | Line 844 | public class ForkJoinPoolTest extends JS
844          List<Callable<String>> l = new ArrayList<Callable<String>>();
845          l.add(new NPETask());
846          try {
847 <            e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
847 >            e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
848              shouldThrow();
849          } catch (ExecutionException success) {
850              assertTrue(success.getCause() instanceof NullPointerException);
# Line 869 | Line 862 | public class ForkJoinPoolTest extends JS
862              List<Callable<String>> l = new ArrayList<Callable<String>>();
863              l.add(new StringTask());
864              l.add(new StringTask());
865 <            String result = e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
865 >            String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
866              assertSame(TEST_STRING, result);
867          } finally {
868              joinPool(e);
# Line 882 | Line 875 | public class ForkJoinPoolTest extends JS
875      public void testTimedInvokeAll1() throws Throwable {
876          ExecutorService e = new ForkJoinPool(1);
877          try {
878 <            e.invokeAll(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
878 >            e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS);
879              shouldThrow();
880          } catch (NullPointerException success) {
881          } finally {
# Line 914 | Line 907 | public class ForkJoinPoolTest extends JS
907          try {
908              List<Future<String>> r
909                  = e.invokeAll(new ArrayList<Callable<String>>(),
910 <                              MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
910 >                              MEDIUM_DELAY_MS, MILLISECONDS);
911              assertTrue(r.isEmpty());
912          } finally {
913              joinPool(e);
# Line 930 | Line 923 | public class ForkJoinPoolTest extends JS
923          l.add(new StringTask());
924          l.add(null);
925          try {
926 <            e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
926 >            e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
927              shouldThrow();
928          } catch (NullPointerException success) {
929          } finally {
# Line 946 | Line 939 | public class ForkJoinPoolTest extends JS
939          List<Callable<String>> l = new ArrayList<Callable<String>>();
940          l.add(new NPETask());
941          List<Future<String>> futures
942 <            = e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
942 >            = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
943          assertEquals(1, futures.size());
944          try {
945              futures.get(0).get();
# Line 968 | Line 961 | public class ForkJoinPoolTest extends JS
961              l.add(new StringTask());
962              l.add(new StringTask());
963              List<Future<String>> futures
964 <                = e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
964 >                = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
965              assertEquals(2, futures.size());
966              for (Future<String> future : futures)
967                  assertSame(TEST_STRING, future.get());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines