|
|||||||||
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
public class 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, envImpl, handleLockToHandleMap, handleToHandleLockMap, id, lockManager, lockTimeOutMillis, readUncommittedDefault, thread |
Constructor Summary | |
---|---|
BuddyLocker(EnvironmentImpl env,
Locker buddy)
Creates a BuddyLocker. |
Method Summary | |
---|---|
(package private) Locker |
getBuddy()
Returns the buddy locker. |
Txn |
getTxnLocker()
Forwards this call to the buddy locker. |
Locker |
newNonTxnLocker()
Creates a new instance of this txn for the same environment. |
void |
releaseNonTxnLocks()
Forwards this call to the base class and to the buddy locker. |
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, isReadCommittedIsolation, 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, isHandleLockTransferrable, isReadUncommittedDefault, 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
DatabaseException
Method Detail |
---|
Locker getBuddy()
public Txn getTxnLocker()
getTxnLocker
in class BasicLocker
public Locker newNonTxnLocker() throws DatabaseException
newNonTxnLocker
in class BasicLocker
DatabaseException
public void releaseNonTxnLocks() throws DatabaseException
releaseNonTxnLocks
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 |