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

Comparing jsr166/src/test/tck/ForkJoinPool8Test.java (file contents):
Revision 1.35 by jsr166, Sat Mar 18 18:20:00 2017 UTC vs.
Revision 1.40 by jsr166, Sun Jul 22 20:27:47 2018 UTC

# Line 5 | Line 5
5   */
6  
7   import static java.util.concurrent.TimeUnit.MILLISECONDS;
8 import static java.util.concurrent.TimeUnit.SECONDS;
8  
9   import java.util.HashSet;
10   import java.util.concurrent.CancellationException;
# Line 84 | Line 83 | public class ForkJoinPool8Test extends J
83  
84              Thread.currentThread().interrupt();
85              try {
86 <                a.get(5L, SECONDS);
86 >                a.get(randomTimeout(), randomTimeUnit());
87                  shouldThrow();
88              } catch (InterruptedException success) {
89              } catch (Throwable fail) { threadUnexpectedException(fail); }
90          }
91  
92          try {
93 <            a.get(0L, SECONDS);
93 >            a.get(randomExpiredTimeout(), randomTimeUnit());
94              shouldThrow();
95          } catch (TimeoutException success) {
96          } catch (Throwable fail) { threadUnexpectedException(fail); }
# Line 107 | Line 106 | public class ForkJoinPool8Test extends J
106          assertNull(a.join());
107          assertFalse(a.cancel(false));
108          assertFalse(a.cancel(true));
109 +
110 +        Object v1 = null, v2 = null;
111          try {
112 <            assertNull(a.get());
113 <        } catch (Throwable fail) { threadUnexpectedException(fail); }
113 <        try {
114 <            assertNull(a.get(5L, SECONDS));
112 >            v1 = a.get();
113 >            v2 = a.get(randomTimeout(), randomTimeUnit());
114          } catch (Throwable fail) { threadUnexpectedException(fail); }
115 +        assertNull(v1);
116 +        assertNull(v2);
117      }
118  
119      void checkCancelled(ForkJoinTask a) {
# Line 136 | Line 137 | public class ForkJoinPool8Test extends J
137          } catch (Throwable fail) { threadUnexpectedException(fail); }
138  
139          try {
140 <            a.get(5L, SECONDS);
140 >            a.get(randomTimeout(), randomTimeUnit());
141              shouldThrow();
142          } catch (CancellationException success) {
143          } catch (Throwable fail) { threadUnexpectedException(fail); }
# Line 167 | Line 168 | public class ForkJoinPool8Test extends J
168          } catch (Throwable fail) { threadUnexpectedException(fail); }
169  
170          try {
171 <            a.get(5L, SECONDS);
171 >            a.get(randomTimeout(), randomTimeUnit());
172              shouldThrow();
173          } catch (ExecutionException success) {
174              assertSame(t.getClass(), success.getCause().getClass());
# Line 356 | Line 357 | public class ForkJoinPool8Test extends J
357              protected void realCompute() throws Exception {
358                  FibAction f = new FibAction(8);
359                  assertSame(f, f.fork());
360 <                assertNull(f.get(5L, SECONDS));
360 >                assertNull(f.get(LONG_DELAY_MS, MILLISECONDS));
361                  assertEquals(21, f.result);
362                  checkCompletedNormally(f);
363              }};
# Line 372 | Line 373 | public class ForkJoinPool8Test extends J
373                  FibAction f = new FibAction(8);
374                  assertSame(f, f.fork());
375                  try {
376 <                    f.get(5L, null);
376 >                    f.get(randomTimeout(), null);
377                      shouldThrow();
378                  } catch (NullPointerException success) {}
379              }};
# Line 472 | Line 473 | public class ForkJoinPool8Test extends J
473                  FailingFibAction f = new FailingFibAction(8);
474                  assertSame(f, f.fork());
475                  try {
476 <                    f.get(5L, SECONDS);
476 >                    f.get(LONG_DELAY_MS, MILLISECONDS);
477                      shouldThrow();
478                  } catch (ExecutionException success) {
479                      Throwable cause = success.getCause();
# Line 564 | Line 565 | public class ForkJoinPool8Test extends J
565                  assertTrue(f.cancel(true));
566                  assertSame(f, f.fork());
567                  try {
568 <                    f.get(5L, SECONDS);
568 >                    f.get(LONG_DELAY_MS, MILLISECONDS);
569                      shouldThrow();
570                  } catch (CancellationException success) {
571                      checkCancelled(f);
# Line 1040 | Line 1041 | public class ForkJoinPool8Test extends J
1041                  CCF f = new LCCF(null, 8);
1042                  assertSame(f, f.fork());
1043                  try {
1044 <                    f.get(5L, null);
1044 >                    f.get(randomTimeout(), null);
1045                      shouldThrow();
1046                  } catch (NullPointerException success) {}
1047              }};
# Line 1533 | Line 1534 | public class ForkJoinPool8Test extends J
1534       * timeout elapsed
1535       */
1536      public void testAwaitQuiescence2() throws Exception {
1537 <        /**
1537 >        /*
1538           * """It is possible to disable or limit the use of threads in the
1539           * common pool by setting the parallelism property to zero. However
1540           * doing so may cause unjoined tasks to never be executed."""

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines