jdk/test/java/util/concurrent/tck/RecursiveActionTest.java
changeset 45937 646816090183
parent 44589 64d9270bd24c
--- a/jdk/test/java/util/concurrent/tck/RecursiveActionTest.java	Sat Jul 22 09:13:53 2017 -0700
+++ b/jdk/test/java/util/concurrent/tck/RecursiveActionTest.java	Sat Jul 22 09:18:50 2017 -0700
@@ -31,7 +31,7 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -100,14 +100,14 @@
 
             Thread.currentThread().interrupt();
             try {
-                a.get(5L, SECONDS);
+                a.get(randomTimeout(), randomTimeUnit());
                 shouldThrow();
             } catch (InterruptedException success) {
             } catch (Throwable fail) { threadUnexpectedException(fail); }
         }
 
         try {
-            a.get(0L, SECONDS);
+            a.get(randomExpiredTimeout(), randomTimeUnit());
             shouldThrow();
         } catch (TimeoutException success) {
         } catch (Throwable fail) { threadUnexpectedException(fail); }
@@ -125,9 +125,7 @@
         assertFalse(a.cancel(true));
         try {
             assertNull(a.get());
-        } catch (Throwable fail) { threadUnexpectedException(fail); }
-        try {
-            assertNull(a.get(5L, SECONDS));
+            assertNull(a.get(randomTimeout(), randomTimeUnit()));
         } catch (Throwable fail) { threadUnexpectedException(fail); }
     }
 
@@ -152,7 +150,7 @@
         } catch (Throwable fail) { threadUnexpectedException(fail); }
 
         try {
-            a.get(5L, SECONDS);
+            a.get(randomTimeout(), randomTimeUnit());
             shouldThrow();
         } catch (CancellationException success) {
         } catch (Throwable fail) { threadUnexpectedException(fail); }
@@ -183,7 +181,7 @@
         } catch (Throwable fail) { threadUnexpectedException(fail); }
 
         try {
-            a.get(5L, SECONDS);
+            a.get(randomTimeout(), randomTimeUnit());
             shouldThrow();
         } catch (ExecutionException success) {
             assertSame(t.getClass(), success.getCause().getClass());
@@ -469,7 +467,7 @@
             protected void realCompute() throws Exception {
                 FibAction f = new FibAction(8);
                 assertSame(f, f.fork());
-                assertNull(f.get(5L, SECONDS));
+                assertNull(f.get(LONG_DELAY_MS, MILLISECONDS));
                 assertEquals(21, f.result);
                 checkCompletedNormally(f);
             }};
@@ -485,7 +483,7 @@
                 FibAction f = new FibAction(8);
                 assertSame(f, f.fork());
                 try {
-                    f.get(5L, null);
+                    f.get(randomTimeout(), null);
                     shouldThrow();
                 } catch (NullPointerException success) {}
             }};
@@ -604,7 +602,7 @@
                 FailingFibAction f = new FailingFibAction(8);
                 assertSame(f, f.fork());
                 try {
-                    f.get(5L, SECONDS);
+                    f.get(LONG_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (ExecutionException success) {
                     Throwable cause = success.getCause();
@@ -696,7 +694,7 @@
                 assertTrue(f.cancel(true));
                 assertSame(f, f.fork());
                 try {
-                    f.get(5L, SECONDS);
+                    f.get(LONG_DELAY_MS, MILLISECONDS);
                     shouldThrow();
                 } catch (CancellationException success) {
                     checkCancelled(f);