|
|||||||||
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[] |
lockTableLatches
|
protected int |
nLockTables
|
(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,
int lockTableIndex)
|
(package private) abstract void |
demote(long nodeId,
Locker locker)
Demote a lock from write to read. |
protected void |
demoteInternal(long nodeId,
Locker locker,
int lockTableIndex)
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,
int i)
Do the real work of dumpLockTableInternal. |
String |
dumpToString()
|
void |
envConfigUpdate(DbConfigManager configMgr)
Process notifications of mutable property changes. |
protected int |
getLockTableIndex(long nodeId)
|
protected int |
getLockTableIndex(Long nodeId)
|
(package private) abstract Locker |
getWriteOwnerLocker(Long nodeId)
|
protected Locker |
getWriteOwnerLockerInternal(Long nodeId,
int lockTableIndex)
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,
int lockTableIndex)
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,
int lockTableIndex)
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,
int lockTableIndex)
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 Lock |
lookupLock(Long nodeId)
|
protected Lock |
lookupLockInternal(Long nodeId,
int lockTableIndex)
|
protected abstract DeadlockException |
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 DeadlockException |
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,
int lockTableIndex)
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,
int lockTableIndex)
Do the real work of nWaiters. |
(package private) 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,
Locker locker)
Release the lock, and return the set of new owners to notify, if any. |
protected Set |
releaseAndFindNotifyTargetsInternal(long nodeId,
Locker locker,
int lockTableIndex)
Do the real work of releaseAndFindNotifyTargets |
(package private) static void |
setLockTableDump(boolean enable)
Called when the je.txn.dumpLocks property is changed. |
(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,
int lockTableIndex)
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,
int lockTableIndex)
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,
int lockTableIndex)
|
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 int nLockTables
protected Latch[] lockTableLatches
Constructor Detail |
---|
public LockManager(EnvironmentImpl envImpl) throws DatabaseException
DatabaseException
Method Detail |
---|
public void envConfigUpdate(DbConfigManager configMgr) throws DatabaseException
envConfigUpdate
in interface EnvConfigObserver
DatabaseException
static void setLockTableDump(boolean enable)
protected int getLockTableIndex(Long nodeId)
protected int getLockTableIndex(long nodeId)
public LockGrantType lock(long nodeId, Locker locker, LockType type, long timeout, boolean nonBlockingRequest, DatabaseImpl database) throws DeadlockException, 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.
DatabaseException
protected abstract Lock lookupLock(Long nodeId) throws DatabaseException
DatabaseException
protected Lock lookupLockInternal(Long nodeId, int lockTableIndex) throws DatabaseException
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, int lockTableIndex) throws DatabaseException
DatabaseException
protected abstract DeadlockException 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 DeadlockException makeTimeoutMsgInternal(String lockOrTxn, Locker locker, long nodeId, LockType type, LockGrantType grantType, Lock useLock, long timeout, long start, long now, DatabaseImpl database)
boolean release(long nodeId, Locker locker) throws DatabaseException
nodeId
- The node ID of the lock to release.
DatabaseException
protected abstract Set releaseAndFindNotifyTargets(long nodeId, Locker locker) throws DatabaseException
DatabaseException
protected Set releaseAndFindNotifyTargetsInternal(long nodeId, Locker locker, int lockTableIndex) 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, int lockTableIndex) throws DatabaseException
DatabaseException
abstract void transferMultiple(long nodeId, Locker owningLocker, Locker[] destLockers) throws DatabaseException
DatabaseException
protected void transferMultipleInternal(long nodeId, Locker owningLocker, Locker[] destLockers, int lockTableIndex) 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, int lockTableIndex) throws DatabaseException
DatabaseException
abstract boolean isLocked(Long nodeId) throws DatabaseException
nodeId
- The NodeId to check.
DatabaseException
protected boolean isLockedInternal(Long nodeId, int lockTableIndex)
abstract boolean isOwner(Long nodeId, Locker locker, LockType type) throws DatabaseException
DatabaseException
protected boolean isOwnerInternal(Long nodeId, Locker locker, LockType type, int lockTableIndex)
abstract boolean isWaiter(Long nodeId, Locker locker) throws DatabaseException
DatabaseException
protected boolean isWaiterInternal(Long nodeId, Locker locker, int lockTableIndex)
abstract int nWaiters(Long nodeId) throws DatabaseException
DatabaseException
protected int nWaitersInternal(Long nodeId, int lockTableIndex)
abstract int nOwners(Long nodeId) throws DatabaseException
DatabaseException
protected int nOwnersInternal(Long nodeId, int lockTableIndex)
abstract Locker getWriteOwnerLocker(Long nodeId) throws DatabaseException
DatabaseException
protected Locker getWriteOwnerLockerInternal(Long nodeId, int lockTableIndex) 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, int lockTableIndex) 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, int i)
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 |