public void m() { lock.lock(); // block until condition holds try { // ... method body } finally { lock.unlock() } } } In addition to implementing the {@link Lock} interface, thisclass defines methods isLocked and getLockQueueLength, as well as some associated protected access methods that may be useful for instrumentation and monitoring. Serialization of this class behaves in the same way as built-in locks: a deserialized lock is in the unlocked state, regardless of its state when serialized. This lock supports a maximum of 2147483647 recursive locks by the same thread. Attempts to exceed this limit result in {@link Error} throws from locking methods.
@author Doug Lea
@author Dawid Kurzyniec
@since 1.5
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.