|
|||||||||
| 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, readUncommittedDefault, thread |
| Constructor Summary | |
|---|---|
protected |
BuddyLocker(EnvironmentImpl env,
Locker buddy)
Creates a BuddyLocker. |
| Method Summary | |
|---|---|
static BuddyLocker |
createBuddyLocker(EnvironmentImpl env,
Locker buddy)
|
(package private) Locker |
getBuddy()
Returns the buddy locker. |
long |
getLockTimeout()
Returns the lock timeout of the buddy locker, since this locker has no independent timeout. |
Txn |
getTxnLocker()
Forwards this call to the buddy locker. |
long |
getTxnTimeout()
Returns the transaction timeout of the buddy locker, since this locker has no independent timeout. |
boolean |
isTimedOut()
Returns whether the buddy locker is timed out, since this locker has no independent timeout. |
void |
releaseNonTxnLocks()
Forwards this call to the base class and to the buddy locker. |
void |
setLockTimeout(long timeout)
Sets the lock timeout of the buddy locker, since this locker has no independent timeout. |
void |
setTxnTimeout(long timeout)
Sets the transaction timeout of the buddy locker, since this locker has no independent timeout. |
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, createBasicLocker, createBasicLocker, createBasicLocker, createdNode, generateId, getAbortLsn, getWriteLockInfo, getWriteOwnerLocker, isReadCommittedIsolation, isSerializableIsolation, isTransactional, lockInternal, markDeleteAtTxnEnd, moveWriteToReadLock, newNonTxnLocker, nonTxnOperationEnd, operationEnd, registerCursor, removeLock, setHandleLockOwner, unRegisterCursor |
| Methods inherited from class com.sleepycat.je.txn.Locker |
|---|
addDeleteInfo, addToHandleMaps, close, demoteLock, dumpLockTable, getDefaultNoWait, getId, getTxnStartMillis, getWaitingFor, initApiReadLock, isHandleLockTransferrable, isReadUncommittedDefault, lock, nonBlockingLock, operationEnd, operationEnd, releaseLock, setOnlyAbortable, setWaitingFor, toString, transferHandleLock, transferHandleLockToHandle, unregisterHandle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected BuddyLocker(EnvironmentImpl env,
Locker buddy)
throws DatabaseException
DatabaseException| Method Detail |
|---|
public static BuddyLocker createBuddyLocker(EnvironmentImpl env,
Locker buddy)
throws DatabaseException
DatabaseExceptionLocker getBuddy()
public Txn getTxnLocker()
getTxnLocker in class BasicLocker
public void releaseNonTxnLocks()
throws DatabaseException
releaseNonTxnLocks in class BasicLockerDatabaseExceptionpublic boolean sharesLocksWith(Locker other)
sharesLocksWith in class Lockerpublic long getLockTimeout()
getLockTimeout in class Lockerpublic long getTxnTimeout()
getTxnTimeout in class Lockerpublic void setLockTimeout(long timeout)
setLockTimeout in class Lockertimeout - The timeout value for the transaction lifetime, in
microseconds. A value of 0 disables timeouts for the transaction.public void setTxnTimeout(long timeout)
setTxnTimeout in class Lockertimeout - The timeout value for the transaction lifetime, in
microseconds. A value of 0 disables timeouts for the transaction.
public boolean isTimedOut()
throws DatabaseException
isTimedOut in class LockerDatabaseException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||