public class BuddyLocker extends BasicLocker
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.
defaultNoWait, deleteInfo, envImpl, handleLockToHandleMap, handleToHandleLockMap, id, lockManager, lockTimeOutMillis, readUncommittedDefault, thread
Constructor and Description |
---|
BuddyLocker(EnvironmentImpl env,
Locker buddy)
Creates a BuddyLocker.
|
Modifier and Type | Method and Description |
---|---|
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.
|
checkState, collectStats, createdNode, generateId, getAbortLsn, getOwnerAbortLsn, getWriteLockInfo, getWriteOwnerLocker, isReadCommittedIsolation, isSerializableIsolation, isTransactional, markDeleteAtTxnEnd, operationEnd, operationEnd, registerCursor, setHandleLockOwner, unRegisterCursor
addDeleteInfo, addToHandleMaps, demoteLock, dumpLockTable, getDefaultNoWait, getId, getLockTimeout, getTxnTimeOut, isHandleLockTransferrable, isReadUncommittedDefault, isTimedOut, lock, nonBlockingLock, operationEnd, releaseLock, setLockTimeout, setTxnTimeout, toString, transferHandleLock
public BuddyLocker(EnvironmentImpl env, Locker buddy) throws DatabaseException
DatabaseException
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