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

Comparing jsr166/src/test/tck/AbstractQueuedLongSynchronizerTest.java (file contents):
Revision 1.36 by jsr166, Fri Jul 3 05:48:30 2015 UTC vs.
Revision 1.39 by jsr166, Sun May 14 02:20:48 2017 UTC

# Line 235 | Line 235 | public class AbstractQueuedLongSynchroni
235       * default timeout duration).
236       */
237      void assertAwaitTimesOut(ConditionObject c, AwaitMethod awaitMethod) {
238 <        long timeoutMillis = timeoutMillis();
239 <        long startTime;
238 >        final long timeoutMillis = timeoutMillis();
239 >        final long startTime;
240          try {
241              switch (awaitMethod) {
242              case awaitTimed:
# Line 255 | Line 255 | public class AbstractQueuedLongSynchroni
255              case awaitUntil:
256                  // We shouldn't assume that nanoTime and currentTimeMillis
257                  // use the same time source, so don't use nanoTime here.
258 <                java.util.Date delayedDate = delayedDate(timeoutMillis());
258 >                java.util.Date delayedDate = delayedDate(timeoutMillis);
259                  assertFalse(c.awaitUntil(delayedDate(timeoutMillis)));
260                  assertTrue(new java.util.Date().getTime() >= delayedDate.getTime());
261                  break;
# Line 965 | Line 965 | public class AbstractQueuedLongSynchroni
965       */
966      public void testAwaitUninterruptibly() {
967          final Mutex sync = new Mutex();
968 <        final ConditionObject c = sync.newCondition();
968 >        final ConditionObject condition = sync.newCondition();
969          final BooleanLatch pleaseInterrupt = new BooleanLatch();
970          Thread t = newStartedThread(new CheckedRunnable() {
971              public void realRun() {
972                  sync.acquire();
973                  assertTrue(pleaseInterrupt.releaseShared(0));
974 <                c.awaitUninterruptibly();
974 >                condition.awaitUninterruptibly();
975                  assertTrue(Thread.interrupted());
976 <                assertHasWaitersLocked(sync, c, NO_THREADS);
976 >                assertHasWaitersLocked(sync, condition, NO_THREADS);
977                  sync.release();
978              }});
979  
980          pleaseInterrupt.acquireShared(0);
981          sync.acquire();
982 <        assertHasWaitersLocked(sync, c, t);
982 >        assertHasWaitersLocked(sync, condition, t);
983          sync.release();
984          t.interrupt();
985 <        assertHasWaitersUnlocked(sync, c, t);
986 <        assertThreadStaysAlive(t);
985 >        assertHasWaitersUnlocked(sync, condition, t);
986 >        assertThreadBlocks(t, Thread.State.WAITING);
987          sync.acquire();
988 <        assertHasWaitersLocked(sync, c, t);
988 >        assertHasWaitersLocked(sync, condition, t);
989          assertHasExclusiveQueuedThreads(sync, NO_THREADS);
990 <        c.signal();
991 <        assertHasWaitersLocked(sync, c, NO_THREADS);
990 >        condition.signal();
991 >        assertHasWaitersLocked(sync, condition, NO_THREADS);
992          assertHasExclusiveQueuedThreads(sync, t);
993          sync.release();
994          awaitTermination(t);
# Line 1131 | Line 1131 | public class AbstractQueuedLongSynchroni
1131  
1132          waitForQueuedThread(l, t);
1133          assertFalse(l.isSignalled());
1134 <        assertThreadStaysAlive(t);
1134 >        assertThreadBlocks(t, Thread.State.WAITING);
1135          assertHasSharedQueuedThreads(l, t);
1136          assertTrue(l.releaseShared(0));
1137          assertTrue(l.isSignalled());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines