|
|||||||||
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 |
---|
ReentrantReadWriteLock.ReadLock, ReentrantReadWriteLock.WriteLock |
Constructor Summary | |
---|---|
SharedLatch(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(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(String name)
Method Detail |
---|
public void setName(String name)
public boolean setNoteLatch(boolean noteLatch)
public void setExclusiveOnly(boolean exclusiveOnly)
public void acquireExclusive()
EnvironmentFailureException
- if the latch is already held by the
current thread for shared access.public boolean acquireExclusiveNoWait()
EnvironmentFailureException
- if the latch is already held by the
calling thread.public void acquireShared()
public void release()
public void releaseIfOwner()
public boolean isOwner()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |