public class SharedLatchImpl extends java.lang.Object implements SharedLatch
| Constructor and Description |
|---|
SharedLatchImpl(java.lang.String name,
EnvironmentImpl env)
Create a shared latch.
|
| 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.
|
boolean |
isWriteLockedByCurrentThread() |
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)
If noteLatch is true, then track latch usage in the latchTable.
|
public SharedLatchImpl(java.lang.String name,
EnvironmentImpl env)
public void setExclusiveOnly(boolean exclusiveOnly)
setExclusiveOnly in interface SharedLatchpublic void setName(java.lang.String name)
setName in interface SharedLatchpublic boolean setNoteLatch(boolean noteLatch)
setNoteLatch in interface SharedLatchpublic void acquireExclusive()
throws DatabaseException
acquireExclusive in interface SharedLatchLatchException - if the latch is already held by the current
thread for shared access.RunRecoveryException - if an InterruptedException exception
occurs.DatabaseExceptionpublic boolean acquireExclusiveNoWait()
throws DatabaseException
SharedLatchacquireExclusiveNoWait in interface SharedLatchLatchException - if the latch is already held by the calling
thread.DatabaseExceptionpublic void acquireShared()
throws DatabaseException
acquireShared in interface SharedLatchRunRecoveryException - if an InterruptedException exception
occurs.DatabaseExceptionpublic boolean isOwner()
SharedLatchisOwner in interface SharedLatchpublic void release()
throws LatchNotHeldException
release in interface SharedLatchLatchNotHeldExceptionpublic void releaseIfOwner()
throws LatchNotHeldException
SharedLatchreleaseIfOwner in interface SharedLatchLatchNotHeldExceptionpublic boolean isWriteLockedByCurrentThread()
isWriteLockedByCurrentThread in interface SharedLatch