24 |
|
* java.util.concurrent.locks.Lock lock} is not available: |
25 |
|
* |
26 |
|
* <pre> Lock lock = ...; |
27 |
< |
* if ( lock.tryLock(50L, TimeUnit.MILLISECONDS) ) ... |
27 |
> |
* if (lock.tryLock(50L, TimeUnit.MILLISECONDS)) ... |
28 |
|
* </pre> |
29 |
|
* while this code will timeout in 50 seconds: |
30 |
|
* <pre> |
31 |
|
* Lock lock = ...; |
32 |
< |
* if ( lock.tryLock(50L, TimeUnit.SECONDS) ) ... |
32 |
> |
* if (lock.tryLock(50L, TimeUnit.SECONDS)) ... |
33 |
|
* </pre> |
34 |
|
* |
35 |
|
* Note however, that there is no guarantee that a particular timeout |
270 |
|
* method (see {@link BlockingQueue#poll BlockingQueue.poll}) |
271 |
|
* using: |
272 |
|
* |
273 |
< |
* <pre> public synchronized Object poll(long timeout, TimeUnit unit) throws InterruptedException { |
274 |
< |
* while (empty) { |
275 |
< |
* unit.timedWait(this, timeout); |
276 |
< |
* ... |
277 |
< |
* } |
278 |
< |
* }</pre> |
273 |
> |
* <pre> {@code |
274 |
> |
* public synchronized Object poll(long timeout, TimeUnit unit) |
275 |
> |
* throws InterruptedException { |
276 |
> |
* while (empty) { |
277 |
> |
* unit.timedWait(this, timeout); |
278 |
> |
* ... |
279 |
> |
* } |
280 |
> |
* }}</pre> |
281 |
|
* |
282 |
|
* @param obj the object to wait on |
283 |
|
* @param timeout the maximum time to wait. If less than |