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

Comparing jsr166/src/test/tck/AbstractQueuedSynchronizerTest.java (file contents):
Revision 1.29 by jsr166, Sat Nov 21 02:07:26 2009 UTC vs.
Revision 1.32 by jsr166, Mon Nov 30 08:31:09 2009 UTC

# Line 10 | Line 10
10   import junit.framework.*;
11   import java.util.*;
12   import java.util.concurrent.*;
13 + import static java.util.concurrent.TimeUnit.MILLISECONDS;
14   import java.util.concurrent.locks.*;
15   import java.io.*;
16  
# Line 326 | Line 327 | public class AbstractQueuedSynchronizerT
327          sync.acquire(1);
328          Thread t = new Thread(new CheckedInterruptedRunnable() {
329              public void realRun() throws InterruptedException {
330 <                sync.tryAcquireNanos(1, MEDIUM_DELAY_MS * 1000 * 1000);
330 >                sync.tryAcquireNanos(1, MEDIUM_DELAY_MS * 1000L * 1000L);
331              }});
332  
333          t.start();
334 +        Thread.sleep(SHORT_DELAY_MS);
335          t.interrupt();
336          t.join();
337      }
# Line 359 | Line 361 | public class AbstractQueuedSynchronizerT
361          sync.acquire(1);
362          Thread t = new Thread(new CheckedRunnable() {
363              public void realRun() throws InterruptedException {
364 <                threadAssertFalse(sync.tryAcquireNanos(1, 1000 * 1000));
364 >                threadAssertFalse(sync.tryAcquireNanos(1, SHORT_DELAY_MS * 1000L * 1000L));
365              }});
366  
367          t.start();
# Line 416 | Line 418 | public class AbstractQueuedSynchronizerT
418          sync.acquireInterruptibly(1);
419          Thread t = new Thread(new InterruptedSyncRunnable(sync));
420          t.start();
421 +        Thread.sleep(SHORT_DELAY_MS);
422          t.interrupt();
423          assertTrue(sync.isHeldExclusively());
424          t.join();
# Line 475 | Line 478 | public class AbstractQueuedSynchronizerT
478          final Mutex sync = new Mutex();
479          final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition();
480          sync.acquire(1);
481 <        assertFalse(c.await(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
481 >        assertFalse(c.await(SHORT_DELAY_MS, MILLISECONDS));
482          sync.release(1);
483      }
484  
# Line 785 | Line 788 | public class AbstractQueuedSynchronizerT
788              public void realRun() throws InterruptedException {
789                  sync.acquire(1);
790                  c.await();
788                sync.release(1);
791              }});
792  
793          t.start();
# Line 804 | Line 806 | public class AbstractQueuedSynchronizerT
806          Thread t = new Thread(new CheckedInterruptedRunnable() {
807              public void realRun() throws InterruptedException {
808                  sync.acquire(1);
809 <                c.awaitNanos(1000 * 1000 * 1000); // 1 sec
808 <                sync.release(1);
809 >                c.awaitNanos(LONG_DELAY_MS * 1000L * 1000L);
810              }});
811  
812          t.start();
# Line 826 | Line 827 | public class AbstractQueuedSynchronizerT
827                  sync.acquire(1);
828                  java.util.Date d = new java.util.Date();
829                  c.awaitUntil(new java.util.Date(d.getTime() + 10000));
829                sync.release(1);
830              }});
831  
832          t.start();
# Line 954 | Line 954 | public class AbstractQueuedSynchronizerT
954          Thread t = new Thread(new CheckedRunnable() {
955              public void realRun() throws InterruptedException {
956                  threadAssertFalse(l.isSignalled());
957 <                threadAssertTrue(l.tryAcquireSharedNanos(0, MEDIUM_DELAY_MS* 1000 * 1000));
957 >                threadAssertTrue(l.tryAcquireSharedNanos(0, MEDIUM_DELAY_MS * 1000L * 1000L));
958                  threadAssertTrue(l.isSignalled());
959              }});
960  
# Line 991 | Line 991 | public class AbstractQueuedSynchronizerT
991          Thread t = new Thread(new CheckedInterruptedRunnable() {
992              public void realRun() throws InterruptedException {
993                  threadAssertFalse(l.isSignalled());
994 <                l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000);
994 >                l.tryAcquireSharedNanos(0, SMALL_DELAY_MS * 1000L * 1000L);
995              }});
996  
997          t.start();
# Line 1009 | Line 1009 | public class AbstractQueuedSynchronizerT
1009          Thread t = new Thread(new CheckedRunnable() {
1010              public void realRun() throws InterruptedException {
1011                  threadAssertFalse(l.isSignalled());
1012 <                threadAssertFalse(l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000));
1012 >                threadAssertFalse(l.tryAcquireSharedNanos(0, SMALL_DELAY_MS * 1000L * 1000L));
1013              }});
1014  
1015          t.start();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines