Package ch.tocco.nice2.toolbox.api
Class LockPool.Lock
java.lang.Object
ch.tocco.nice2.toolbox.api.LockPool.Lock
- All Implemented Interfaces:
Lock
A shared keyed lock. Delegates all methods to an instance of
ReentrantLock
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
int
int
getWaitQueueLength
(Condition condition) boolean
hasQueuedThread
(Thread thread) boolean
boolean
hasWaiters
(Condition condition) boolean
isFair()
boolean
boolean
isLocked()
void
lock()
void
toString()
boolean
tryLock()
boolean
void
unlock()
-
Method Details
-
lock
public void lock() -
lockInterruptibly
- Specified by:
lockInterruptibly
in interfaceLock
- Throws:
InterruptedException
- See Also:
-
tryLock
public boolean tryLock() -
tryLock
- Specified by:
tryLock
in interfaceLock
- Throws:
InterruptedException
- See Also:
-
unlock
public void unlock() -
newCondition
- Specified by:
newCondition
in interfaceLock
- See Also:
-
getQueueLength
public int getQueueLength()- See Also:
-
hasQueuedThreads
public boolean hasQueuedThreads()- See Also:
-
isHeldByCurrentThread
public boolean isHeldByCurrentThread()- See Also:
-
getWaitQueueLength
- See Also:
-
getHoldCount
public int getHoldCount()- See Also:
-
isLocked
public boolean isLocked()- See Also:
-
hasQueuedThread
- See Also:
-
isFair
public boolean isFair()- See Also:
-
hasWaiters
- See Also:
-
toString
-