|
|||||||||
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;
Field Summary | |
---|---|
(package private) Latch[] |
lockTableLatches
|
(package private) int |
nLockTables
|
(package private) static long |
TOTAL_LOCKIMPL_OVERHEAD
|
(package private) static long |
TOTAL_THINLOCKIMPL_OVERHEAD
|
Constructor Summary | |
---|---|
LockManager(EnvironmentImpl envImpl)
|
Method Summary | |
---|---|
(package private) abstract LockAttemptResult |
attemptLock(Long nodeId,
Locker locker,
LockType type,
boolean nonBlockingRequest)
|
(package private) 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. |
(package private) void |
demoteInternal(long nodeId,
Locker locker,
int lockTableIndex)
Do the real work of demote. |
void |
dump()
Debugging |
(package private) abstract void |
dumpLockTable(StatGroup tableStats,
boolean clear)
Dump the lock table to the lock stats. |
(package private) void |
dumpLockTableInternal(StatGroup tableStats,
int i,
boolean clear)
Do the real work of dumpLockTableInternal. |
String |
dumpToString()
|
void |
envConfigUpdate(DbConfigManager configMgr,
EnvironmentMutableConfig ignore)
Process notifications of mutable property changes. |
(package private) int |
getLockTableIndex(long nodeId)
|
(package private) int |
getLockTableIndex(Long nodeId)
|
Iterator<ThreadLocker> |
getThreadLockers(Thread thread)
Returns an iterator over all thread lockers for the given thread, or an empty iterator if none. |
(package private) abstract Locker |
getWriteOwnerLocker(Long nodeId)
|
(package private) 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. |
(package private) 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. |
(package private) 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. |
(package private) boolean |
isWaiterInternal(Long nodeId,
Locker locker,
int lockTableIndex)
Do the real work of isWaiter. |
StatGroup |
loadStats(StatsConfig config)
|
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 |
(package private) abstract Lock |
lookupLock(Long nodeId)
|
(package private) Lock |
lookupLockInternal(Long nodeId,
int lockTableIndex)
|
(package private) abstract LockConflictException |
makeTimeoutMsg(boolean isLockNotTxnTimeout,
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. |
(package private) LockConflictException |
makeTimeoutMsgInternal(boolean isLockNotTxnTimeout,
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) LockConflictException |
newLockNotAvailableException(Locker locker,
String msg)
This method should always be called instead of explicitly creating LockNotAvailableException, to ensure that je.lock.oldLockExceptions is enforced. |
(package private) abstract int |
nOwners(Long nodeId)
Return the number of owners of this lock. |
(package private) 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. |
(package private) int |
nWaitersInternal(Long nodeId,
int lockTableIndex)
Do the real work of nWaiters. |
void |
registerThreadLocker(ThreadLocker locker)
Called when a ThreadLocker is created. |
boolean |
release(long nodeId,
Locker locker)
Release a lock and possibly notify any waiters that they have been granted the lock. |
(package private) abstract Set<Locker> |
releaseAndFindNotifyTargets(long nodeId,
Locker locker)
Release the lock, and return the set of new owners to notify, if any. |
(package private) 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. |
protected abstract LockAttemptResult |
stealLock(Long nodeId,
Locker locker,
LockType lockType,
MemoryBudget mb)
|
protected LockAttemptResult |
stealLockInternal(Long nodeId,
Locker locker,
LockType lockType,
MemoryBudget mb,
int lockTableIndex)
|
(package private) abstract void |
transfer(long nodeId,
Locker owningLocker,
Locker destLocker,
boolean demoteToRead)
Transfer ownership a lock from one locker to another locker. |
(package private) 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. |
(package private) void |
transferMultipleInternal(long nodeId,
Locker owningLocker,
Locker[] destLockers,
int lockTableIndex)
Do the real work of transferMultiple |
void |
unregisterThreadLocker(ThreadLocker locker)
Called when a ThreadLocker is closed. |
(package private) abstract boolean |
validateOwnership(Long nodeId,
Locker locker,
LockType type,
boolean flushFromWaiters,
MemoryBudget mb)
|
(package private) 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_LOCKIMPL_OVERHEAD
static final long TOTAL_THINLOCKIMPL_OVERHEAD
int nLockTables
Latch[] lockTableLatches
Constructor Detail |
---|
public LockManager(EnvironmentImpl envImpl)
Method Detail |
---|
public void envConfigUpdate(DbConfigManager configMgr, EnvironmentMutableConfig ignore)
envConfigUpdate
in interface EnvConfigObserver
static void setLockTableDump(boolean enable)
int getLockTableIndex(Long nodeId)
int getLockTableIndex(long nodeId)
public LockGrantType lock(long nodeId, Locker locker, LockType type, long timeout, boolean nonBlockingRequest, DatabaseImpl database) throws LockConflictException, 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.
LockConflictException
- if lock could not be acquired.
IllegalArgumentException
- via db/cursor read/write methods, if
non-transactional access to a replicated environment is attempted, and
read-uncommitted is not specified.
DatabaseException
abstract Lock lookupLock(Long nodeId) throws DatabaseException
DatabaseException
Lock lookupLockInternal(Long nodeId, int lockTableIndex)
abstract LockAttemptResult attemptLock(Long nodeId, Locker locker, LockType type, boolean nonBlockingRequest) throws DatabaseException
DatabaseException
LockAttemptResult attemptLockInternal(Long nodeId, Locker locker, LockType type, boolean nonBlockingRequest, int lockTableIndex) throws DatabaseException
DatabaseException
abstract LockConflictException makeTimeoutMsg(boolean isLockNotTxnTimeout, Locker locker, long nodeId, LockType type, LockGrantType grantType, Lock useLock, long timeout, long start, long now, DatabaseImpl database) throws DatabaseException
DatabaseException
LockConflictException makeTimeoutMsgInternal(boolean isLockNotTxnTimeout, Locker locker, long nodeId, LockType type, LockGrantType grantType, Lock useLock, long timeout, long start, long now, DatabaseImpl database)
LockConflictException newLockNotAvailableException(Locker locker, String msg)
public boolean release(long nodeId, Locker locker) throws DatabaseException
nodeId
- The node ID of the lock to release.
DatabaseException
abstract Set<Locker> releaseAndFindNotifyTargets(long nodeId, Locker locker) throws DatabaseException
DatabaseException
Set<Locker> releaseAndFindNotifyTargetsInternal(long nodeId, Locker locker, int lockTableIndex)
abstract void transfer(long nodeId, Locker owningLocker, Locker destLocker, boolean demoteToRead) throws DatabaseException
DatabaseException
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
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
void demoteInternal(long nodeId, Locker locker, int lockTableIndex)
abstract boolean isLocked(Long nodeId) throws DatabaseException
nodeId
- The NodeId to check.
DatabaseException
boolean isLockedInternal(Long nodeId, int lockTableIndex)
abstract boolean isOwner(Long nodeId, Locker locker, LockType type) throws DatabaseException
DatabaseException
boolean isOwnerInternal(Long nodeId, Locker locker, LockType type, int lockTableIndex)
abstract boolean isWaiter(Long nodeId, Locker locker) throws DatabaseException
DatabaseException
boolean isWaiterInternal(Long nodeId, Locker locker, int lockTableIndex)
abstract int nWaiters(Long nodeId) throws DatabaseException
DatabaseException
int nWaitersInternal(Long nodeId, int lockTableIndex)
abstract int nOwners(Long nodeId) throws DatabaseException
DatabaseException
int nOwnersInternal(Long nodeId, int lockTableIndex)
abstract Locker getWriteOwnerLocker(Long nodeId) throws DatabaseException
DatabaseException
Locker getWriteOwnerLockerInternal(Long nodeId, int lockTableIndex)
abstract boolean validateOwnership(Long nodeId, Locker locker, LockType type, boolean flushFromWaiters, MemoryBudget mb) throws DatabaseException
DatabaseException
boolean validateOwnershipInternal(Long nodeId, Locker locker, LockType type, boolean flushFromWaiters, MemoryBudget mb, int lockTableIndex)
protected abstract LockAttemptResult stealLock(Long nodeId, Locker locker, LockType lockType, MemoryBudget mb) throws DatabaseException
DatabaseException
protected LockAttemptResult stealLockInternal(Long nodeId, Locker locker, LockType lockType, MemoryBudget mb, int lockTableIndex) throws DatabaseException
DatabaseException
public void registerThreadLocker(ThreadLocker locker)
public void unregisterThreadLocker(ThreadLocker locker)
public Iterator<ThreadLocker> getThreadLockers(Thread thread)
public LockStats lockStat(StatsConfig config) throws DatabaseException
DatabaseException
public StatGroup loadStats(StatsConfig config)
abstract void dumpLockTable(StatGroup tableStats, boolean clear) throws DatabaseException
DatabaseException
void dumpLockTableInternal(StatGroup tableStats, int i, boolean clear)
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 |