Returns a {@link Condition} instance for use with this{@link Lock} instance.
The returned {@link Condition} instance supports the sameusages as do the {@link Object} monitor methods ({@link Object#wait() wait}, {@link Object#notify notify}, and {@link Object#notifyAll notifyAll}) when used with the built-in monitor lock.
- If this lock is not held when any of the {@link Condition}{@linkplain Condition#await() waiting} or {@linkplain Condition#signal signalling} methods are called, then an {@link IllegalMonitorStateException} is thrown.
- When the condition {@linkplain Condition#await() waiting}methods are called the lock is released and, before they return, the lock is reacquired and the lock hold count restored to what it was when the method was called.
- If a strand is {@linkplain Strand#interrupt interrupted}while waiting then the wait will terminate, an {@link InterruptedException} will be thrown, and the strand'sinterrupted status will be cleared.
- Waiting strands are signalled in FIFO order.
- The ordering of lock reacquisition for strands returning from waiting methods is the same as for strands initially acquiring the lock, which is in the default case not specified, but for fair locks favors those strands that have been waiting the longest.
@return the Condition object