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 |
|
|
476 |
|
final Mutex sync = new Mutex(); |
477 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
478 |
|
sync.acquire(1); |
479 |
< |
assertFalse(c.await(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
479 |
> |
assertFalse(c.await(SHORT_DELAY_MS, MILLISECONDS)); |
480 |
|
sync.release(1); |
481 |
|
} |
482 |
|
|
786 |
|
public void realRun() throws InterruptedException { |
787 |
|
sync.acquire(1); |
788 |
|
c.await(); |
788 |
– |
sync.release(1); |
789 |
|
}}); |
790 |
|
|
791 |
|
t.start(); |
805 |
|
public void realRun() throws InterruptedException { |
806 |
|
sync.acquire(1); |
807 |
|
c.awaitNanos(1000 * 1000 * 1000); // 1 sec |
808 |
– |
sync.release(1); |
808 |
|
}}); |
809 |
|
|
810 |
|
t.start(); |
825 |
|
sync.acquire(1); |
826 |
|
java.util.Date d = new java.util.Date(); |
827 |
|
c.awaitUntil(new java.util.Date(d.getTime() + 10000)); |
829 |
– |
sync.release(1); |
828 |
|
}}); |
829 |
|
|
830 |
|
t.start(); |