| java.lang.Object com.sleepycat.je.txn.LockManager
All known Subclasses: com.sleepycat.je.txn.DummyLockManager, com.sleepycat.je.txn.LatchedLockManager, com.sleepycat.je.txn.SyncedLockManager,
LockManager | abstract public class LockManager implements EnvConfigObserver(Code) | | LockManager manages locks.
Note that locks are counted as taking up part of the JE cache;
|
Inner Class :static class LockAttemptResult | |
Method Summary | |
abstract protected LockAttemptResult | attemptLock(Long nodeId, Locker locker, LockType type, boolean nonBlockingRequest) | protected LockAttemptResult | attemptLockInternal(Long nodeId, Locker locker, LockType type, boolean nonBlockingRequest, int lockTableIndex) | 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. | public void | dump() | abstract protected 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. | public String | dumpToString() | public void | envConfigUpdate(DbConfigManager configMgr) Process notifications of mutable property changes. | protected int | getLockTableIndex(Long nodeId) | protected int | getLockTableIndex(long nodeId) | abstract Locker | getWriteOwnerLocker(Long nodeId) | protected Locker | getWriteOwnerLockerInternal(Long nodeId, int lockTableIndex) Do the real work of getWriteOwnerLocker. | 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. | 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. | 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. | public LockGrantType | lock(long nodeId, Locker locker, LockType type, long timeout, boolean nonBlockingRequest, DatabaseImpl database) Attempt to acquire a lock of type on nodeId. | public LockStats | lockStat(StatsConfig config) | abstract protected Lock | lookupLock(Long nodeId) | protected Lock | lookupLockInternal(Long nodeId, int lockTableIndex) | abstract protected 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. | 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. | 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. | boolean | release(long nodeId, Locker locker) Release a lock and possibly notify any waiters that they have been
granted the lock.
Parameters: nodeId - The node ID of the lock to release. | abstract protected 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) | static void | setLockTableDump(boolean enable) Called when the je.txn.dumpLocks property is changed. | 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) | 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) | abstract protected 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) |
TOTAL_LOCK_OVERHEAD | final static long TOTAL_LOCK_OVERHEAD(Code) | | |
lockTableLatches | protected Latch[] lockTableLatches(Code) | | |
nLockTables | protected int nLockTables(Code) | | |
demote | abstract void demote(long nodeId, Locker locker) throws DatabaseException(Code) | | Demote a lock from write to read. Call back to the owning locker to
move this to its read collection.
Parameters: lock - The lock to release. If null, use nodeId to find lock Parameters: locker - |
demoteInternal | protected void demoteInternal(long nodeId, Locker locker, int lockTableIndex) throws DatabaseException(Code) | | Do the real work of demote.
|
dumpLockTableInternal | protected void dumpLockTableInternal(LockStats stats, int i)(Code) | | Do the real work of dumpLockTableInternal.
|
getLockTableIndex | protected int getLockTableIndex(Long nodeId)(Code) | | |
getLockTableIndex | protected int getLockTableIndex(long nodeId)(Code) | | |
getWriteOwnerLockerInternal | protected Locker getWriteOwnerLockerInternal(Long nodeId, int lockTableIndex) throws DatabaseException(Code) | | Do the real work of getWriteOwnerLocker.
|
isLocked | abstract boolean isLocked(Long nodeId) throws DatabaseException(Code) | | Test the status of the lock on nodeId. If any transaction holds any
lock on it, true is returned. If no transaction holds a lock on it,
false is returned.
This method is only used by unit tests.
Parameters: nodeId - The NodeId to check. true if any transaction holds any lock on the nodeid. falseif no lock is held by any transaction. |
isLockedInternal | protected boolean isLockedInternal(Long nodeId, int lockTableIndex)(Code) | | Do the real work of isLocked.
|
isOwner | abstract boolean isOwner(Long nodeId, Locker locker, LockType type) throws DatabaseException(Code) | | Return true if this locker owns this a lock of this type on given node.
This method is only used by unit tests.
|
isOwnerInternal | protected boolean isOwnerInternal(Long nodeId, Locker locker, LockType type, int lockTableIndex)(Code) | | Do the real work of isOwner.
|
isWaiter | abstract boolean isWaiter(Long nodeId, Locker locker) throws DatabaseException(Code) | | Return true if this locker is waiting on this lock.
This method is only used by unit tests.
|
isWaiterInternal | protected boolean isWaiterInternal(Long nodeId, Locker locker, int lockTableIndex)(Code) | | Do the real work of isWaiter.
|
lock | public LockGrantType lock(long nodeId, Locker locker, LockType type, long timeout, boolean nonBlockingRequest, DatabaseImpl database) throws DeadlockException, DatabaseException(Code) | | Attempt to acquire a lock of type on nodeId. If the lock
acquisition would result in a deadlock, throw an exception. If the
requested lock is not currently available, block until it is or until
timeout milliseconds have elapsed. If a lock of type is
already held, return EXISTING. If a WRITE lock is held and a READ
lock is requested, return PROMOTION.
If a lock request is for a lock that is not currently held, return
either NEW or DENIED depending on whether the lock is granted or
not.
Parameters: nodeId - The NodeId to lock. Parameters: locker - The Locker to lock this on behalf of. Parameters: type - The lock type requested. Parameters: timeout - milliseconds to time out after if lock couldn't beobtained. 0 means block indefinitely. Not used if nonBlockingRequestis true. Parameters: nonBlockingRequest - if true, means don't block if lock can't beacquired, and ignore the timeout parameter. a LockGrantType indicating whether the request was fulfilledor not. LockGrantType.NEW means the lock grant was fulfilled andthe caller did not previously hold the lock. PROMOTION means thelock was granted and it was a promotion from READ to WRITE. EXISTINGmeans the lock was already granted (not a promotion). DENIED meansthe lock was not granted either because the timeout passed withoutacquiring the lock or timeout was -1 and the lock was not immediatelyavailable. throws: DeadlockException - if acquiring the lock would result ina deadlock. |
nOwnersInternal | protected int nOwnersInternal(Long nodeId, int lockTableIndex)(Code) | | Do the real work of nWaiters.
|
nWaitersInternal | protected int nWaitersInternal(Long nodeId, int lockTableIndex)(Code) | | Do the real work of nWaiters.
|
release | boolean release(long nodeId, Locker locker) throws DatabaseException(Code) | | Release a lock and possibly notify any waiters that they have been
granted the lock.
Parameters: nodeId - The node ID of the lock to release. true if the lock is released successfully, false ifthe lock is not currently being held. |
releaseAndFindNotifyTargets | abstract protected Set releaseAndFindNotifyTargets(long nodeId, Locker locker) throws DatabaseException(Code) | | Release the lock, and return the set of new owners to notify, if any.
null if the lock does not exist or the given locker was not the owner,a non-empty set if owners should be notified after releasing,an empty set if no notification is required. |
releaseAndFindNotifyTargetsInternal | protected Set releaseAndFindNotifyTargetsInternal(long nodeId, Locker locker, int lockTableIndex) throws DatabaseException(Code) | | Do the real work of releaseAndFindNotifyTargets
|
setLockTableDump | static void setLockTableDump(boolean enable)(Code) | | Called when the je.txn.dumpLocks property is changed.
|
transfer | abstract void transfer(long nodeId, Locker owningLocker, Locker destLocker, boolean demoteToRead) throws DatabaseException(Code) | | Transfer ownership a lock from one locker to another locker. We're not
sending any notification to the waiters on the lock table, and the past
and present owner should be ready for the transfer.
|
transferInternal | protected void transferInternal(long nodeId, Locker owningLocker, Locker destLocker, boolean demoteToRead, int lockTableIndex) throws DatabaseException(Code) | | Do the real work of transfer
|
transferMultiple | abstract void transferMultiple(long nodeId, Locker owningLocker, Locker[] destLockers) throws DatabaseException(Code) | | Transfer ownership a lock from one locker to a set of other txns,
cloning the lock as necessary. This will always be demoted to read, as
we can't have multiple locker owners any other way. We're not sending
any notification to the waiters on the lock table, and the past and
present owners should be ready for the transfer.
|
transferMultipleInternal | protected void transferMultipleInternal(long nodeId, Locker owningLocker, Locker[] destLockers, int lockTableIndex) throws DatabaseException(Code) | | Do the real work of transferMultiple
|
|
|