|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.txn.Locker
com.sleepycat.je.txn.BasicLocker
com.sleepycat.je.txn.BuddyLocker
Extends BasicLocker to share locks with another specific locker.
In general, a BuddyLocker can be used whenever the primary (API) locker is in use, and we need to lock a node and release that lock before the primary locker transaction ends. In other words, for this particular lock we don't want to use two-phase locking. To accomplish that we use a separate BuddyLocker instance to hold the lock, while sharing locks with the primary locker. The BuddyLocker can be closed to release this particular lock, without releasing the other locks held by the primary locker.
In particular, a BuddyLocker is used when acquiring a RANGE_INSERT lock. RANGE_INSERT only needs to be held until the point we have inserted the new node into the BIN. A separate locker is therefore used so we can release that lock separately when the insertion into the BIN is complete. But the RANGE_INSERT lock must not conflict with locks held by the primary locker. So a BuddyLocker is used that shares locks with the primary locker.
Field Summary |
Fields inherited from class com.sleepycat.je.txn.Locker |
defaultNoWait, deleteInfo, dirtyReadDefault, envImpl, handleLockToHandleMap, handleToHandleLockMap, id, lockManager, lockTimeOutMillis, thread |
Constructor Summary | |
BuddyLocker(EnvironmentImpl env,
Locker buddy)
Creates a BuddyLocker. |
Method Summary | |
(package private) Locker |
getBuddy()
Returns the buddy locker. |
Locker |
newInstance()
Creates a new instance of this locker for the same environment. |
boolean |
sharesLocksWith(Locker other)
Returns whether this locker can share locks with the given locker. |
Methods inherited from class com.sleepycat.je.txn.BasicLocker |
addLock, checkState, collectStats, createdNode, generateId, getAbortKnownDeleted, getAbortLsn, getOwnerAbortLsn, getWriteOwnerLocker, isSerializableIsolation, isTransactional, lock, markDeleteAtTxnEnd, moveWriteToReadLock, nonBlockingReadLock, operationEnd, operationEnd, registerCursor, removeLock, setHandleLockOwner, unRegisterCursor |
Methods inherited from class com.sleepycat.je.txn.Locker |
addDeleteInfo, addToHandleMaps, demoteLock, dumpLockTable, getId, getLockTimeout, getTxnStartMillis, getTxnTimeOut, getWaitingFor, isDirtyReadDefault, isHandleLockTransferrable, isTimedOut, operationEnd, releaseLock, rememberHandleWriteLock, setLockTimeout, setOnlyAbortable, setTxnTimeout, setWaitingFor, toString, transferHandleLock, transferHandleLockToHandle, unregisterHandle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BuddyLocker(EnvironmentImpl env, Locker buddy) throws DatabaseException
Method Detail |
Locker getBuddy()
public Locker newInstance() throws DatabaseException
newInstance
in class BasicLocker
DatabaseException
public boolean sharesLocksWith(Locker other)
sharesLocksWith
in class Locker
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |