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 SharedLatch
public void setName(java.lang.String name)
setName
in interface SharedLatch
public boolean setNoteLatch(boolean noteLatch)
setNoteLatch
in interface SharedLatch
public void acquireExclusive() throws DatabaseException
acquireExclusive
in interface SharedLatch
LatchException
- if the latch is already held by the current
thread for shared access.RunRecoveryException
- if an InterruptedException exception
occurs.DatabaseException
public boolean acquireExclusiveNoWait() throws DatabaseException
SharedLatch
acquireExclusiveNoWait
in interface SharedLatch
LatchException
- if the latch is already held by the calling
thread.DatabaseException
public void acquireShared() throws DatabaseException
acquireShared
in interface SharedLatch
RunRecoveryException
- if an InterruptedException exception
occurs.DatabaseException
public boolean isOwner()
SharedLatch
isOwner
in interface SharedLatch
public void release() throws LatchNotHeldException
release
in interface SharedLatch
LatchNotHeldException
public void releaseIfOwner() throws LatchNotHeldException
SharedLatch
releaseIfOwner
in interface SharedLatch
LatchNotHeldException
public boolean isWriteLockedByCurrentThread()
isWriteLockedByCurrentThread
in interface SharedLatch