|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.concurrent.locks.ReentrantReadWriteLock
com.sleepycat.je.latch.SharedLatch
public class SharedLatch
Simple thread-based non-transactional reader-writer/shared-exclusive latch. Latches provide simple exclusive or shared transient locks on objects. Latches are expected to be held for short, defined periods of time. No deadlock detection is provided so it is the caller's responsibility to sequence latch acquisition in an ordered fashion to avoid deadlocks.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.concurrent.locks.ReentrantReadWriteLock |
---|
java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock, java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock |
Constructor Summary | |
---|---|
SharedLatch(java.lang.String name)
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.util.concurrent.locks.ReentrantReadWriteLock |
---|
getOwner, getQueuedReaderThreads, getQueuedThreads, getQueuedWriterThreads, getQueueLength, getReadHoldCount, getReadLockCount, getWaitingThreads, getWaitQueueLength, getWriteHoldCount, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isWriteLocked, isWriteLockedByCurrentThread, readLock, toString, writeLock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SharedLatch(java.lang.String name)
Method Detail |
---|
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |