Java java.util.concurrent.locks ReentrantLock fields, constructors, methods, implement or subclass

Example usage for Java java.util.concurrent.locks ReentrantLock fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.util.concurrent.locks ReentrantLock.

The text is from its open source code.

Subclass

java.util.concurrent.locks.ReentrantLock has subclasses.
Click this link to see all its subclasses.

Constructor

ReentrantLock()
Creates an instance of ReentrantLock .
ReentrantLock(boolean fair)
Creates an instance of ReentrantLock with the given fairness policy.

Method

ClassgetClass()
Returns the runtime class of this Object .
intgetHoldCount()
Queries the number of holds on this lock by the current thread.
intgetQueueLength()
Returns an estimate of the number of threads waiting to acquire this lock.
inthashCode()
Returns a hash code value for the object.
booleanhasQueuedThreads()
Queries whether any threads are waiting to acquire this lock.
booleanisHeldByCurrentThread()
Queries if this lock is held by the current thread.
booleanisLocked()
Queries if this lock is held by any thread.
voidlock()
Acquires the lock.
voidlockInterruptibly()
Acquires the lock unless the current thread is Thread#interrupt interrupted .
StringtoString()
Returns a string identifying this lock, as well as its lock state.
booleantryLock(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 .
booleantryLock()
Acquires the lock only if it is not held by another thread at the time of invocation.
voidunlock()
Attempts to release this lock.