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 |
|
|
478 |
|
final Mutex sync = new Mutex(); |
479 |
|
final AbstractQueuedLongSynchronizer.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 |
|
|
788 |
|
public void realRun() throws InterruptedException { |
789 |
|
sync.acquire(1); |
790 |
|
c.await(); |
790 |
– |
sync.release(1); |
791 |
|
}}); |
792 |
|
|
793 |
|
t.start(); |
807 |
|
public void realRun() throws InterruptedException { |
808 |
|
sync.acquire(1); |
809 |
|
c.awaitNanos(1000 * 1000 * 1000); // 1 sec |
810 |
– |
sync.release(1); |
810 |
|
}}); |
811 |
|
|
812 |
|
t.start(); |
827 |
|
sync.acquire(1); |
828 |
|
java.util.Date d = new java.util.Date(); |
829 |
|
c.awaitUntil(new java.util.Date(d.getTime() + 10000)); |
831 |
– |
sync.release(1); |
830 |
|
}}); |
831 |
|
|
832 |
|
t.start(); |