public class LatchImpl extends ReentrantLock implements SharedLatch
| Modifier and Type | Method and Description |
|---|---|
void |
acquireExclusive()
Acquires a latch for exclusive/write access.
|
boolean |
acquireExclusiveNoWait()
Acquires a latch for exclusive/write access, but do not block if it's
not available.
|
void |
acquireShared()
Acquires a latch for shared/read access.
|
void |
clearStats()
Resets collected stat values to zero.
|
String |
debugString()
Returns the same information as
Latch.toString() plus all known debug
info. |
Thread |
getExclusiveOwner()
Returns the thread that currently holds the latch for exclusive access.
|
int |
getNWaiters()
Returns an estimate of the number of threads waiting.
|
StatGroup |
getStats()
Returns a stats group with information about this latch.
|
boolean |
isExclusiveOnly()
Returns whether this latch is exclusive-only.
|
boolean |
isExclusiveOwner()
Returns true if the current thread holds this latch for exclusive/write
access.
|
boolean |
isOwner()
Returns true if the current thread holds this latch.
|
void |
release()
Releases the latch.
|
void |
releaseIfOwner()
Releases the latch.
|
String |
toString()
Returns the latch name and exclusive owner info.
|
getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, tryLock, tryLock, unlockpublic boolean isExclusiveOnly()
SharedLatchisExclusiveOnly in interface SharedLatchpublic void acquireExclusive()
LatchacquireExclusive in interface Latchpublic boolean acquireExclusiveNoWait()
LatchacquireExclusiveNoWait in interface Latchpublic void acquireShared()
SharedLatchLatch.acquireExclusive().acquireShared in interface SharedLatchpublic void release()
Latchpublic void releaseIfOwner()
LatchreleaseIfOwner in interface Latchpublic boolean isOwner()
LatchLatch.isExclusiveOwner().public boolean isExclusiveOwner()
LatchisExclusiveOwner in interface Latchpublic Thread getExclusiveOwner()
LatchgetExclusiveOwner in interface Latchpublic int getNWaiters()
LatchgetNWaiters in interface Latchpublic StatGroup getStats()
Latchpublic void clearStats()
LatchclearStats in interface Latchpublic String toString()
LatchtoString in interface LatchtoString in class ReentrantLockpublic String debugString()
LatchLatch.toString() plus all known debug
info.debugString in interface LatchCopyright © 2024. All rights reserved.