public abstract class LockManager extends java.lang.Object implements EnvConfigObserver
| Modifier and Type | Field and Description |
|---|---|
protected Latch[] |
lockTableLatches |
protected int |
nLockTables |
(package private) static long |
TOTAL_LOCKIMPL_OVERHEAD |
(package private) static long |
TOTAL_THINLOCKIMPL_OVERHEAD |
| Constructor and Description |
|---|
LockManager(EnvironmentImpl envImpl) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract LockAttemptResult |
attemptLock(java.lang.Long nodeId,
Locker locker,
LockType type,
boolean nonBlockingRequest) |
protected LockAttemptResult |
attemptLockInternal(java.lang.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.
|
java.lang.String |
dumpToString() |
void |
envConfigUpdate(DbConfigManager configMgr,
EnvironmentMutableConfig ignore)
Process notifications of mutable property changes.
|
protected int |
getLockTableIndex(long nodeId) |
protected int |
getLockTableIndex(java.lang.Long nodeId) |
(package private) abstract Locker |
getWriteOwnerLocker(java.lang.Long nodeId) |
protected Locker |
getWriteOwnerLockerInternal(java.lang.Long nodeId,
int lockTableIndex)
Do the real work of getWriteOwnerLocker.
|
(package private) abstract boolean |
isLocked(java.lang.Long nodeId)
Test the status of the lock on nodeId.
|
protected boolean |
isLockedInternal(java.lang.Long nodeId,
int lockTableIndex)
Do the real work of isLocked.
|
(package private) abstract boolean |
isOwner(java.lang.Long nodeId,
Locker locker,
LockType type)
Return true if this locker owns this a lock of this type on given node.
|
protected boolean |
isOwnerInternal(java.lang.Long nodeId,
Locker locker,
LockType type,
int lockTableIndex)
Do the real work of isOwner.
|
(package private) abstract boolean |
isWaiter(java.lang.Long nodeId,
Locker locker)
Return true if this locker is waiting on this lock.
|
protected boolean |
isWaiterInternal(java.lang.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(java.lang.Long nodeId) |
protected Lock |
lookupLockInternal(java.lang.Long nodeId,
int lockTableIndex) |
protected abstract DeadlockException |
makeTimeoutMsg(java.lang.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(java.lang.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(java.lang.Long nodeId)
Return the number of owners of this lock.
|
protected int |
nOwnersInternal(java.lang.Long nodeId,
int lockTableIndex)
Do the real work of nWaiters.
|
(package private) abstract int |
nWaiters(java.lang.Long nodeId)
Return the number of waiters for this lock.
|
protected int |
nWaitersInternal(java.lang.Long nodeId,
int lockTableIndex)
Do the real work of nWaiters.
|
boolean |
release(long nodeId,
Locker locker)
Release a lock and possibly notify any waiters that they have been
granted the lock.
|
protected abstract java.util.Set<Locker> |
releaseAndFindNotifyTargets(long nodeId,
Locker locker)
Release the lock, and return the set of new owners to notify, if any.
|
protected java.util.Set<Locker> |
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(java.lang.Long nodeId,
Locker locker,
LockType type,
boolean flushFromWaiters,
MemoryBudget mb) |
protected boolean |
validateOwnershipInternal(java.lang.Long nodeId,
Locker locker,
LockType type,
boolean flushFromWaiters,
MemoryBudget mb,
int lockTableIndex) |
static final long TOTAL_LOCKIMPL_OVERHEAD
static final long TOTAL_THINLOCKIMPL_OVERHEAD
protected int nLockTables
protected Latch[] lockTableLatches
public LockManager(EnvironmentImpl envImpl) throws DatabaseException
DatabaseExceptionpublic void envConfigUpdate(DbConfigManager configMgr, EnvironmentMutableConfig ignore) throws DatabaseException
envConfigUpdate in interface EnvConfigObserverDatabaseExceptionstatic void setLockTableDump(boolean enable)
protected int getLockTableIndex(java.lang.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.DatabaseExceptionprotected abstract Lock lookupLock(java.lang.Long nodeId) throws DatabaseException
DatabaseExceptionprotected Lock lookupLockInternal(java.lang.Long nodeId, int lockTableIndex) throws DatabaseException
DatabaseExceptionprotected abstract LockAttemptResult attemptLock(java.lang.Long nodeId, Locker locker, LockType type, boolean nonBlockingRequest) throws DatabaseException
DatabaseExceptionprotected LockAttemptResult attemptLockInternal(java.lang.Long nodeId, Locker locker, LockType type, boolean nonBlockingRequest, int lockTableIndex) throws DatabaseException
DatabaseExceptionprotected abstract DeadlockException makeTimeoutMsg(java.lang.String lockOrTxn, Locker locker, long nodeId, LockType type, LockGrantType grantType, Lock useLock, long timeout, long start, long now, DatabaseImpl database) throws DatabaseException
DatabaseExceptionprotected DeadlockException makeTimeoutMsgInternal(java.lang.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.DatabaseExceptionprotected abstract java.util.Set<Locker> releaseAndFindNotifyTargets(long nodeId, Locker locker) throws DatabaseException
DatabaseExceptionprotected java.util.Set<Locker> releaseAndFindNotifyTargetsInternal(long nodeId, Locker locker, int lockTableIndex) throws DatabaseException
DatabaseExceptionabstract void transfer(long nodeId,
Locker owningLocker,
Locker destLocker,
boolean demoteToRead)
throws DatabaseException
DatabaseExceptionprotected void transferInternal(long nodeId,
Locker owningLocker,
Locker destLocker,
boolean demoteToRead,
int lockTableIndex)
throws DatabaseException
DatabaseExceptionabstract void transferMultiple(long nodeId,
Locker owningLocker,
Locker[] destLockers)
throws DatabaseException
DatabaseExceptionprotected void transferMultipleInternal(long nodeId,
Locker owningLocker,
Locker[] destLockers,
int lockTableIndex)
throws DatabaseException
DatabaseExceptionabstract void demote(long nodeId,
Locker locker)
throws DatabaseException
lock - The lock to release. If null, use nodeId to find locklocker - DatabaseExceptionprotected void demoteInternal(long nodeId,
Locker locker,
int lockTableIndex)
throws DatabaseException
DatabaseExceptionabstract boolean isLocked(java.lang.Long nodeId)
throws DatabaseException
nodeId - The NodeId to check.DatabaseExceptionprotected boolean isLockedInternal(java.lang.Long nodeId,
int lockTableIndex)
abstract boolean isOwner(java.lang.Long nodeId,
Locker locker,
LockType type)
throws DatabaseException
DatabaseExceptionprotected boolean isOwnerInternal(java.lang.Long nodeId,
Locker locker,
LockType type,
int lockTableIndex)
abstract boolean isWaiter(java.lang.Long nodeId,
Locker locker)
throws DatabaseException
DatabaseExceptionprotected boolean isWaiterInternal(java.lang.Long nodeId,
Locker locker,
int lockTableIndex)
abstract int nWaiters(java.lang.Long nodeId)
throws DatabaseException
DatabaseExceptionprotected int nWaitersInternal(java.lang.Long nodeId,
int lockTableIndex)
abstract int nOwners(java.lang.Long nodeId)
throws DatabaseException
DatabaseExceptionprotected int nOwnersInternal(java.lang.Long nodeId,
int lockTableIndex)
abstract Locker getWriteOwnerLocker(java.lang.Long nodeId) throws DatabaseException
DatabaseExceptionprotected Locker getWriteOwnerLockerInternal(java.lang.Long nodeId, int lockTableIndex) throws DatabaseException
DatabaseExceptionprotected abstract boolean validateOwnership(java.lang.Long nodeId,
Locker locker,
LockType type,
boolean flushFromWaiters,
MemoryBudget mb)
throws DatabaseException
DatabaseExceptionprotected boolean validateOwnershipInternal(java.lang.Long nodeId,
Locker locker,
LockType type,
boolean flushFromWaiters,
MemoryBudget mb,
int lockTableIndex)
throws DatabaseException
DatabaseExceptionpublic LockStats lockStat(StatsConfig config) throws DatabaseException
DatabaseExceptionprotected abstract void dumpLockTable(LockStats stats) throws DatabaseException
DatabaseExceptionprotected void dumpLockTableInternal(LockStats stats, int i)
public void dump()
throws DatabaseException
DatabaseExceptionpublic java.lang.String dumpToString()
throws DatabaseException
DatabaseExceptionCopyright (c) 2004,2008 Oracle. All rights reserved.