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.74 by jsr166, Mon May 29 19:15:02 2017 UTC vs.
Revision 1.75 by jsr166, Mon May 29 22:44:27 2017 UTC

# Line 11 | Line 11 | import java.security.PrivilegedAction;
11   import java.security.PrivilegedExceptionAction;
12   import java.util.ArrayList;
13   import java.util.Collection;
14 + import java.util.Collections;
15   import java.util.List;
16   import java.util.concurrent.Callable;
17   import java.util.concurrent.CountDownLatch;
# Line 703 | Line 704 | public class ForkJoinPoolTest extends JS
704      }
705  
706      /**
707 <     * invokeAll(empty collection) returns empty collection
707 >     * invokeAll(empty collection) returns empty list
708       */
709      public void testInvokeAll2() throws InterruptedException {
710          ExecutorService e = new ForkJoinPool(1);
711 +        final Collection<Callable<String>> emptyCollection
712 +            = Collections.emptyList();
713          try (PoolCleaner cleaner = cleaner(e)) {
714 <            List<Future<String>> r
712 <                = e.invokeAll(new ArrayList<Callable<String>>());
714 >            List<Future<String>> r = e.invokeAll(emptyCollection);
715              assertTrue(r.isEmpty());
716          }
717      }
# Line 819 | Line 821 | public class ForkJoinPoolTest extends JS
821              l.add(latchAwaitingStringTask(latch));
822              l.add(null);
823              try {
824 <                e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
824 >                e.invokeAny(l, randomTimeout(), randomTimeUnit());
825                  shouldThrow();
826              } catch (NullPointerException success) {}
827              latch.countDown();
# Line 868 | Line 870 | public class ForkJoinPoolTest extends JS
870          ExecutorService e = new ForkJoinPool(1);
871          try (PoolCleaner cleaner = cleaner(e)) {
872              try {
873 <                e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS);
873 >                e.invokeAll(null, randomTimeout(), randomTimeUnit());
874                  shouldThrow();
875              } catch (NullPointerException success) {}
876          }
# Line 883 | Line 885 | public class ForkJoinPoolTest extends JS
885              List<Callable<String>> l = new ArrayList<>();
886              l.add(new StringTask());
887              try {
888 <                e.invokeAll(l, MEDIUM_DELAY_MS, null);
888 >                e.invokeAll(l, randomTimeout(), null);
889                  shouldThrow();
890              } catch (NullPointerException success) {}
891          }
892      }
893  
894      /**
895 <     * timed invokeAll(empty collection) returns empty collection
895 >     * timed invokeAll(empty collection) returns empty list
896       */
897      public void testTimedInvokeAll2() throws InterruptedException {
898          ExecutorService e = new ForkJoinPool(1);
899 +        final Collection<Callable<String>> emptyCollection
900 +            = Collections.emptyList();
901          try (PoolCleaner cleaner = cleaner(e)) {
902              List<Future<String>> r
903 <                = e.invokeAll(new ArrayList<Callable<String>>(),
904 <                              MEDIUM_DELAY_MS, MILLISECONDS);
903 >                = e.invokeAll(emptyCollection,
904 >                              randomTimeout(), randomTimeUnit());
905              assertTrue(r.isEmpty());
906          }
907      }
# Line 912 | Line 916 | public class ForkJoinPoolTest extends JS
916              l.add(new StringTask());
917              l.add(null);
918              try {
919 <                e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
919 >                e.invokeAll(l, randomTimeout(), randomTimeUnit());
920                  shouldThrow();
921              } catch (NullPointerException success) {}
922          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines