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.12 by jsr166, Sat Nov 21 02:33:20 2009 UTC vs.
Revision 1.15 by jsr166, Tue Dec 1 06:03:49 2009 UTC

# Line 330 | Line 330 | public class AbstractQueuedLongSynchroni
330          sync.acquire(1);
331          Thread t = new Thread(new CheckedInterruptedRunnable() {
332              public void realRun() throws InterruptedException {
333 <                sync.tryAcquireNanos(1, MEDIUM_DELAY_MS * 1000 * 1000);
333 >                sync.tryAcquireNanos(1, MILLISECONDS.toNanos(MEDIUM_DELAY_MS));
334              }});
335  
336          t.start();
337 +        Thread.sleep(SHORT_DELAY_MS);
338          t.interrupt();
339          t.join();
340      }
# Line 363 | Line 364 | public class AbstractQueuedLongSynchroni
364          sync.acquire(1);
365          Thread t = new Thread(new CheckedRunnable() {
366              public void realRun() throws InterruptedException {
367 <                threadAssertFalse(sync.tryAcquireNanos(1, 1000 * 1000));
367 >                long nanos = MILLISECONDS.toNanos(SHORT_DELAY_MS);
368 >                assertFalse(sync.tryAcquireNanos(1, nanos));
369              }});
370  
371          t.start();
# Line 419 | Line 421 | public class AbstractQueuedLongSynchroni
421          sync.acquireInterruptibly(1);
422          Thread t = new Thread(new InterruptedSyncRunnable(sync));
423          t.start();
424 +        Thread.sleep(SHORT_DELAY_MS);
425          t.interrupt();
426          assertTrue(sync.isHeldExclusively());
427          t.join();
# Line 788 | Line 791 | public class AbstractQueuedLongSynchroni
791              public void realRun() throws InterruptedException {
792                  sync.acquire(1);
793                  c.await();
791                sync.release(1);
794              }});
795  
796          t.start();
# Line 807 | Line 809 | public class AbstractQueuedLongSynchroni
809          Thread t = new Thread(new CheckedInterruptedRunnable() {
810              public void realRun() throws InterruptedException {
811                  sync.acquire(1);
812 <                c.awaitNanos(1000 * 1000 * 1000); // 1 sec
811 <                sync.release(1);
812 >                c.awaitNanos(MILLISECONDS.toNanos(LONG_DELAY_MS));
813              }});
814  
815          t.start();
# Line 829 | Line 830 | public class AbstractQueuedLongSynchroni
830                  sync.acquire(1);
831                  java.util.Date d = new java.util.Date();
832                  c.awaitUntil(new java.util.Date(d.getTime() + 10000));
832                sync.release(1);
833              }});
834  
835          t.start();
# Line 956 | Line 956 | public class AbstractQueuedLongSynchroni
956  
957          Thread t = new Thread(new CheckedRunnable() {
958              public void realRun() throws InterruptedException {
959 <                threadAssertFalse(l.isSignalled());
960 <                threadAssertTrue(l.tryAcquireSharedNanos(0, MEDIUM_DELAY_MS* 1000 * 1000));
961 <                threadAssertTrue(l.isSignalled());
959 >                assertFalse(l.isSignalled());
960 >                long nanos = MILLISECONDS.toNanos(MEDIUM_DELAY_MS);
961 >                assertTrue(l.tryAcquireSharedNanos(0, nanos));
962 >                assertTrue(l.isSignalled());
963              }});
964  
965          t.start();
# Line 993 | Line 994 | public class AbstractQueuedLongSynchroni
994          final BooleanLatch l = new BooleanLatch();
995          Thread t = new Thread(new CheckedInterruptedRunnable() {
996              public void realRun() throws InterruptedException {
997 <                threadAssertFalse(l.isSignalled());
998 <                l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000);
997 >                assertFalse(l.isSignalled());
998 >                long nanos = MILLISECONDS.toNanos(SMALL_DELAY_MS);
999 >                l.tryAcquireSharedNanos(0, nanos);
1000              }});
1001  
1002          t.start();
# Line 1011 | Line 1013 | public class AbstractQueuedLongSynchroni
1013          final BooleanLatch l = new BooleanLatch();
1014          Thread t = new Thread(new CheckedRunnable() {
1015              public void realRun() throws InterruptedException {
1016 <                threadAssertFalse(l.isSignalled());
1017 <                threadAssertFalse(l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000));
1016 >                assertFalse(l.isSignalled());
1017 >                long nanos = MILLISECONDS.toNanos(SMALL_DELAY_MS);
1018 >                assertFalse(l.tryAcquireSharedNanos(0, nanos));
1019              }});
1020  
1021          t.start();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines