|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.txn.LockManager
public abstract class LockManager
LockManager manages locks. Note that locks are counted as taking up part of the JE cache;
Nested Class Summary | |
---|---|
(package private) static class |
LockManager.LockAttemptResult
This is just a struct to hold a multi-value return. |
Field Summary | |
---|---|
protected Latch |
lockTableLatch
|
(package private) static long |
TOTAL_LOCK_OVERHEAD
|
Constructor Summary | |
---|---|
LockManager(EnvironmentImpl envImpl)
|
Method Summary | |
---|---|
protected abstract LockManager.LockAttemptResult |
attemptLock(Long nodeId,
Locker locker,
LockType type,
boolean nonBlockingRequest)
|
protected LockManager.LockAttemptResult |
attemptLockInternal(Long nodeId,
Locker locker,
LockType type,
boolean nonBlockingRequest)
|
(package private) abstract void |
demote(long nodeId,
Locker locker)
Demote a lock from write to read. |
protected void |
demoteInternal(long nodeId,
Locker locker)
Do the real work of demote. |
void |
dump()
Debugging |
protected abstract void |
dumpLockTable(LockStats stats)
Dump the lock table to the lock stats. |
protected void |
dumpLockTableInternal(LockStats stats)
Do the real work of dumpLockTableInternal. |
String |
dumpToString()
|
(package private) abstract Locker |
getWriteOwnerLocker(Long nodeId)
|
protected Locker |
getWriteOwnerLockerInternal(Long nodeId)
Do the real work of getWriteOwnerLocker. |
(package private) abstract boolean |
isLocked(Long nodeId)
Test the status of the lock on nodeId. |
protected boolean |
isLockedInternal(Long nodeId)
Do the real work of isLocked. |
(package private) abstract boolean |
isOwner(Long nodeId,
Locker locker,
LockType type)
Return true if this locker owns this a lock of this type on given node. |
protected boolean |
isOwnerInternal(Long nodeId,
Locker locker,
LockType type)
Do the real work of isOwner. |
(package private) abstract boolean |
isWaiter(Long nodeId,
Locker locker)
Return true if this locker is waiting on this lock. |
protected boolean |
isWaiterInternal(Long nodeId,
Locker locker)
Do the real work of isWaiter. |
LockGrantType |
lock(long nodeId,
Locker locker,
LockType type,
long timeout,
boolean nonBlockingRequest,
DatabaseImpl database)
Attempt to acquire a lock of type on nodeId. |
LockStats |
lockStat(StatsConfig config)
Statistics |
protected abstract String |
makeTimeoutMsg(String lockOrTxn,
Locker locker,
long nodeId,
LockType type,
LockGrantType grantType,
Lock useLock,
long timeout,
long start,
long now,
DatabaseImpl database)
Create a informative lock or txn timeout message. |
protected String |
makeTimeoutMsgInternal(String lockOrTxn,
Locker locker,
long nodeId,
LockType type,
LockGrantType grantType,
Lock useLock,
long timeout,
long start,
long now,
DatabaseImpl database)
Do the real work of creating an lock or txn timeout message. |
(package private) abstract int |
nOwners(Long nodeId)
Return the number of owners of this lock. |
protected int |
nOwnersInternal(Long nodeId)
Do the real work of nWaiters. |
(package private) abstract int |
nWaiters(Long nodeId)
Return the number of waiters for this lock. |
protected int |
nWaitersInternal(Long nodeId)
Do the real work of nWaiters. |
boolean |
release(Lock lock,
Locker locker)
Release a lock and possibly notify any waiters that they have been granted the lock. |
boolean |
release(long nodeId,
Locker locker)
Release a lock and possibly notify any waiters that they have been granted the lock. |
protected abstract Set |
releaseAndFindNotifyTargets(long nodeId,
Lock lock,
Locker locker,
boolean removeFromLocker)
Release the lock, and return the set of new owners to notify, if any. |
protected Set |
releaseAndFindNotifyTargetsInternal(long nodeId,
Lock lock,
Locker locker,
boolean removeFromLocker)
Do the real work of releaseAndFindNotifyTargets |
(package private) abstract void |
transfer(long nodeId,
Locker owningLocker,
Locker destLocker,
boolean demoteToRead)
Transfer ownership a lock from one locker to another locker. |
protected void |
transferInternal(long nodeId,
Locker owningLocker,
Locker destLocker,
boolean demoteToRead)
Do the real work of transfer |
(package private) abstract void |
transferMultiple(long nodeId,
Locker owningLocker,
Locker[] destLockers)
Transfer ownership a lock from one locker to a set of other txns, cloning the lock as necessary. |
protected void |
transferMultipleInternal(long nodeId,
Locker owningLocker,
Locker[] destLockers)
Do the real work of transferMultiple |
protected abstract boolean |
validateOwnership(Long nodeId,
Locker locker,
LockType type,
boolean flushFromWaiters,
MemoryBudget mb)
|
protected boolean |
validateOwnershipInternal(Long nodeId,
Locker locker,
LockType type,
boolean flushFromWaiters,
MemoryBudget mb)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final long TOTAL_LOCK_OVERHEAD
protected Latch lockTableLatch
Constructor Detail |
---|
public LockManager(EnvironmentImpl envImpl) throws DatabaseException
DatabaseException
Method Detail |
---|
public LockGrantType lock(long nodeId, Locker locker, LockType type, long timeout, boolean nonBlockingRequest, DatabaseImpl database) throws DeadlockException, LockNotGrantedException, DatabaseException
nodeId
- The NodeId to lock.locker
- The Locker to lock this on behalf of.type
- The lock type requested.timeout
- milliseconds to time out after if lock couldn't be
obtained. 0 means block indefinitely. Not used if nonBlockingRequest
is true.nonBlockingRequest
- if true, means don't block if lock can't be
acquired, and ignore the timeout parameter.
DeadlockException
- if acquiring the lock would result in
a deadlock.
LockNotGrantedException
- if a non-blocking lock was denied.
DatabaseException
protected abstract LockManager.LockAttemptResult attemptLock(Long nodeId, Locker locker, LockType type, boolean nonBlockingRequest) throws DatabaseException
DatabaseException
protected LockManager.LockAttemptResult attemptLockInternal(Long nodeId, Locker locker, LockType type, boolean nonBlockingRequest) throws DatabaseException
DatabaseException
protected abstract String makeTimeoutMsg(String lockOrTxn, Locker locker, long nodeId, LockType type, LockGrantType grantType, Lock useLock, long timeout, long start, long now, DatabaseImpl database) throws DatabaseException
DatabaseException
protected String makeTimeoutMsgInternal(String lockOrTxn, Locker locker, long nodeId, LockType type, LockGrantType grantType, Lock useLock, long timeout, long start, long now, DatabaseImpl database)
public boolean release(long nodeId, Locker locker) throws DatabaseException
nodeId
- The node ID of the lock to release.
DatabaseException
public boolean release(Lock lock, Locker locker) throws DatabaseException
lock
- The lock to release
DatabaseException
protected abstract Set releaseAndFindNotifyTargets(long nodeId, Lock lock, Locker locker, boolean removeFromLocker) throws DatabaseException
DatabaseException
protected Set releaseAndFindNotifyTargetsInternal(long nodeId, Lock lock, Locker locker, boolean removeFromLocker) throws DatabaseException
DatabaseException
abstract void transfer(long nodeId, Locker owningLocker, Locker destLocker, boolean demoteToRead) throws DatabaseException
DatabaseException
protected void transferInternal(long nodeId, Locker owningLocker, Locker destLocker, boolean demoteToRead) throws DatabaseException
DatabaseException
abstract void transferMultiple(long nodeId, Locker owningLocker, Locker[] destLockers) throws DatabaseException
DatabaseException
protected void transferMultipleInternal(long nodeId, Locker owningLocker, Locker[] destLockers) throws DatabaseException
DatabaseException
abstract void demote(long nodeId, Locker locker) throws DatabaseException
lock
- The lock to release. If null, use nodeId to find locklocker
-
DatabaseException
protected void demoteInternal(long nodeId, Locker locker) throws DatabaseException
DatabaseException
abstract boolean isLocked(Long nodeId) throws DatabaseException
nodeId
- The NodeId to check.
DatabaseException
protected boolean isLockedInternal(Long nodeId)
abstract boolean isOwner(Long nodeId, Locker locker, LockType type) throws DatabaseException
DatabaseException
protected boolean isOwnerInternal(Long nodeId, Locker locker, LockType type)
abstract boolean isWaiter(Long nodeId, Locker locker) throws DatabaseException
DatabaseException
protected boolean isWaiterInternal(Long nodeId, Locker locker)
abstract int nWaiters(Long nodeId) throws DatabaseException
DatabaseException
protected int nWaitersInternal(Long nodeId)
abstract int nOwners(Long nodeId) throws DatabaseException
DatabaseException
protected int nOwnersInternal(Long nodeId)
abstract Locker getWriteOwnerLocker(Long nodeId) throws DatabaseException
DatabaseException
protected Locker getWriteOwnerLockerInternal(Long nodeId) throws DatabaseException
DatabaseException
protected abstract boolean validateOwnership(Long nodeId, Locker locker, LockType type, boolean flushFromWaiters, MemoryBudget mb) throws DatabaseException
DatabaseException
protected boolean validateOwnershipInternal(Long nodeId, Locker locker, LockType type, boolean flushFromWaiters, MemoryBudget mb) throws DatabaseException
DatabaseException
public LockStats lockStat(StatsConfig config) throws DatabaseException
DatabaseException
protected abstract void dumpLockTable(LockStats stats) throws DatabaseException
DatabaseException
protected void dumpLockTableInternal(LockStats stats)
public void dump() throws DatabaseException
DatabaseException
public String dumpToString() throws DatabaseException
DatabaseException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |