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

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.140 by dl, Mon Sep 7 17:14:06 2015 UTC vs.
Revision 1.141 by jsr166, Tue Sep 8 16:49:16 2015 UTC

# Line 744 | Line 744 | public class JSR166TestCase extends Test
744      }
745  
746      /** Like Runnable, but with the freedom to throw anything */
747 <    interface Thunk { public void run() throws Throwable; }
747 >    interface Action { public void run() throws Throwable; }
748  
749      /**
750 <     * Runs all the given tasks in parallel, failing if any fail.
750 >     * Runs all the given actions in parallel, failing if any fail.
751       * Useful for running multiple variants of tests that are
752       * necessarily individually slow because they must block.
753       */
754 <    void testInParallel(Thunk ... thunks) {
754 >    void testInParallel(Action ... actions) {
755          ExecutorService pool = Executors.newCachedThreadPool();
756          try {
757 <            ArrayList<Future<?>> futures = new ArrayList<>(thunks.length);
758 <            for (final Thunk thunk : thunks)
757 >            ArrayList<Future<?>> futures = new ArrayList<>(actions.length);
758 >            for (final Action action : actions)
759                  futures.add(pool.submit(new CheckedRunnable() {
760 <                    public void realRun() throws Throwable { thunk.run();}}));
760 >                    public void realRun() throws Throwable { action.run();}}));
761              for (Future<?> future : futures)
762                  try {
763                      assertNull(future.get(LONG_DELAY_MS, MILLISECONDS));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines