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.40 by jsr166, Sun May 15 17:32:29 2011 UTC vs.
Revision 1.44 by dl, Tue Jan 10 13:48:27 2012 UTC

# 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;
# 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       */
# Line 242 | Line 242 | public class ForkJoinPoolTest extends JS
242                                            eh, false);
243          try {
244              assertSame(eh, p.getUncaughtExceptionHandler());
245 <            p.execute(new FibTask(8));
246 <            assertTrue(uehInvoked.await(MEDIUM_DELAY_MS, MILLISECONDS));
245 >            try {
246 >                p.execute(new FibTask(8));
247 >                assertTrue(uehInvoked.await(10000, MILLISECONDS));
248 >            } catch(RejectedExecutionException ok) {
249 >            }
250          } finally {
251              p.shutdownNow(); // failure might have prevented processing task
252              joinPool(p);
# Line 256 | Line 259 | public class ForkJoinPoolTest extends JS
259       * the task has completed successfully, and construction
260       * parameters continue to hold
261       */
262 <    public void testisQuiescent() throws Exception {
262 >    public void testIsQuiescent() throws Exception {
263          ForkJoinPool p = new ForkJoinPool(2);
264          try {
265              assertTrue(p.isQuiescent());
# Line 379 | Line 382 | public class ForkJoinPoolTest extends JS
382          }
383      }
384  
382
385      // FJ Versions of AbstractExecutorService tests
386  
387      /**
# Line 388 | Line 390 | public class ForkJoinPoolTest extends JS
390      public void testExecuteRunnable() throws Throwable {
391          ExecutorService e = new ForkJoinPool(1);
392          try {
393 <            TrackedRunnable task = trackedRunnable(SHORT_DELAY_MS);
394 <            assertFalse(task.isDone());
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              assertNull(future.get());
400 <            assertNull(future.get(MEDIUM_DELAY_MS, MILLISECONDS));
401 <            assertTrue(task.isDone());
400 >            assertNull(future.get(0, MILLISECONDS));
401 >            assertTrue(done.get());
402              assertTrue(future.isDone());
403              assertFalse(future.isCancelled());
404          } finally {
# Line 401 | Line 406 | public class ForkJoinPoolTest extends JS
406          }
407      }
408  
404
409      /**
410       * Completed submit(callable) returns result
411       */
# Line 520 | Line 524 | public class ForkJoinPoolTest extends JS
524          }
525      }
526  
523
527      /**
528       * submit(null callable) throws NullPointerException
529       */
# Line 535 | Line 538 | public class ForkJoinPoolTest extends JS
538          }
539      }
540  
538
541      /**
542       * submit(callable).get() throws InterruptedException if interrupted
543       */
# Line 764 | Line 766 | public class ForkJoinPoolTest extends JS
766          }
767      }
768  
767
769      /**
770       * timed invokeAny(null) throws NullPointerException
771       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines