40 |
|
* threads invoke short read-only methods much more frequently than |
41 |
|
* fully locked methods. |
42 |
|
* |
43 |
< |
* <p> Methods {@code awaitAvailability} and {@code getSequence} can |
43 |
> |
* <p>Methods {@code awaitAvailability} and {@code getSequence} can |
44 |
|
* be used together to define (partially) optimistic read-only methods |
45 |
|
* that are usually more efficient than ReadWriteLocks when they |
46 |
|
* apply. These methods should in general be structured as loops that |
483 |
|
* the lock could be acquired |
484 |
|
* @throws InterruptedException if the current thread is interrupted |
485 |
|
* @throws NullPointerException if the time unit is null |
486 |
– |
* |
486 |
|
*/ |
487 |
|
public boolean tryLock(long timeout, TimeUnit unit) |
488 |
|
throws InterruptedException { |