Example usage for Java java.util.concurrent.locks ReentrantLock fields, constructors, methods, implement or subclass
The text is from its open source code.
ReentrantLock() Creates an instance of ReentrantLock . | |
ReentrantLock(boolean fair) Creates an instance of ReentrantLock with the given fairness policy. |
Class> | getClass() Returns the runtime class of this Object . |
int | getHoldCount() Queries the number of holds on this lock by the current thread. |
int | getQueueLength() Returns an estimate of the number of threads waiting to acquire this lock. |
int | hashCode() Returns a hash code value for the object. |
boolean | hasQueuedThreads() Queries whether any threads are waiting to acquire this lock. |
boolean | isHeldByCurrentThread() Queries if this lock is held by the current thread. |
boolean | isLocked() Queries if this lock is held by any thread. |
void | lock() Acquires the lock. |
void | lockInterruptibly() Acquires the lock unless the current thread is Thread#interrupt interrupted . |
String | toString() Returns a string identifying this lock, as well as its lock state. |
boolean | tryLock(long timeout, TimeUnit unit) Acquires the lock if it is not held by another thread within the given waiting time and the current thread has not been Thread#interrupt interrupted . |
boolean | tryLock() Acquires the lock only if it is not held by another thread at the time of invocation. |
void | unlock() Attempts to release this lock. |