public class SharedLatch
extends java.util.concurrent.locks.ReentrantReadWriteLock
Constructor and Description |
---|
SharedLatch(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
acquireExclusive()
Acquire a latch for exclusive/write access.
|
boolean |
acquireExclusiveNoWait()
Probe a latch for exclusive access, but don't block if it's not
available.
|
void |
acquireShared()
Acquire a latch for shared/read access.
|
boolean |
isOwner()
Return true if this thread is an owner, reader, or write.
|
void |
release()
Release an exclusive or shared latch.
|
void |
releaseIfOwner()
Release the latch.
|
void |
setExclusiveOnly(boolean exclusiveOnly)
Indicate whether this latch can only be set exclusively (not shared).
|
void |
setName(java.lang.String name)
Set the latch name, used for latches in objects instantiated from the
log.
|
boolean |
setNoteLatch(boolean noteLatch)
Indicate whether this latch should be tracked in the debugging
LatchSupport.latchTable.
|
getOwner, getQueuedReaderThreads, getQueuedThreads, getQueuedWriterThreads, getQueueLength, getReadHoldCount, getReadLockCount, getWaitingThreads, getWaitQueueLength, getWriteHoldCount, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isWriteLocked, isWriteLockedByCurrentThread, readLock, toString, writeLock
public void setName(java.lang.String name)
public boolean setNoteLatch(boolean noteLatch)
public void setExclusiveOnly(boolean exclusiveOnly)
public void acquireExclusive() throws DatabaseException
LatchException
- if the latch is already held by the current
thread for shared access.DatabaseException
public boolean acquireExclusiveNoWait() throws DatabaseException
LatchException
- if the latch is already held by the calling
thread.DatabaseException
public void acquireShared() throws DatabaseException
RunRecoveryException
- if an InterruptedException exception
occurs.DatabaseException
public void release() throws LatchNotHeldException
LatchNotHeldException
public void releaseIfOwner() throws LatchNotHeldException
LatchNotHeldException
public boolean isOwner()