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 thread is {@linkplain Thread#interrupt interrupted}while waiting then the wait will terminate, an {@link InterruptedException} will be thrown, and the thread'sinterrupted status will be cleared.
Waiting threads are signalled in FIFO order.
The ordering of lock reacquisition for threads returning from waiting methods is the same as for threads initially acquiring the lock, which is in the default case not specified, but for fair locks favors those threads that have been waiting the longest.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.