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.224 by jsr166, Sat May 13 21:43:50 2017 UTC vs.
Revision 1.230 by jsr166, Mon May 15 16:21:07 2017 UTC

# Line 1066 | Line 1066 | public class JSR166TestCase extends Test
1066       * Checks that thread eventually enters the expected blocked thread state.
1067       */
1068      void assertThreadBlocks(Thread thread, Thread.State expected) {
1069 <        // always sleep at least 1 ms, avoiding transitional states
1070 <        // with high probability
1071 <        for (long retries = LONG_DELAY_MS; retries-->0; ) {
1069 >        // always sleep at least 1 ms, with high probability avoiding
1070 >        // transitory states
1071 >        for (long retries = LONG_DELAY_MS * 3 / 4; retries-->0; ) {
1072              try { delay(1); }
1073              catch (InterruptedException fail) {
1074                  fail("Unexpected InterruptedException");
# Line 1085 | Line 1085 | public class JSR166TestCase extends Test
1085      /**
1086       * Checks that thread does not terminate within the default
1087       * millisecond delay of {@code timeoutMillis()}.
1088 +     * TODO: REMOVEME
1089       */
1090      void assertThreadStaysAlive(Thread thread) {
1091          assertThreadStaysAlive(thread, timeoutMillis());
# Line 1092 | Line 1093 | public class JSR166TestCase extends Test
1093  
1094      /**
1095       * Checks that thread does not terminate within the given millisecond delay.
1096 +     * TODO: REMOVEME
1097       */
1098      void assertThreadStaysAlive(Thread thread, long millis) {
1099          try {
# Line 1104 | Line 1106 | public class JSR166TestCase extends Test
1106      }
1107  
1108      /**
1107     * Checks that the threads do not terminate within the default
1108     * millisecond delay of {@code timeoutMillis()}.
1109     */
1110    void assertThreadsStayAlive(Thread... threads) {
1111        assertThreadsStayAlive(timeoutMillis(), threads);
1112    }
1113
1114    /**
1115     * Checks that the threads do not terminate within the given millisecond delay.
1116     */
1117    void assertThreadsStayAlive(long millis, Thread... threads) {
1118        try {
1119            // No need to optimize the failing case via Thread.join.
1120            delay(millis);
1121            for (Thread thread : threads)
1122                assertTrue(thread.isAlive());
1123        } catch (InterruptedException fail) {
1124            threadFail("Unexpected InterruptedException");
1125        }
1126    }
1127
1128    /**
1109       * Checks that future.get times out, with the default timeout of
1110       * {@code timeoutMillis()}.
1111       */
# Line 1635 | Line 1615 | public class JSR166TestCase extends Test
1615          } catch (Throwable fail) {
1616              threadUnexpectedException(fail);
1617          }
1618 +    }
1619 +
1620 +    public void await(CyclicBarrier barrier) {
1621 +        try {
1622 +            barrier.await(LONG_DELAY_MS, MILLISECONDS);
1623 +        } catch (Throwable fail) {
1624 +            threadUnexpectedException(fail);
1625 +        }
1626      }
1627  
1628   //     /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines