com.sleepycat.je.txn
Class ReadCommittedLocker

java.lang.Object
  extended by com.sleepycat.je.txn.Locker
      extended by com.sleepycat.je.txn.BasicLocker
          extended by com.sleepycat.je.txn.BuddyLocker
              extended by com.sleepycat.je.txn.ReadCommittedLocker

public class ReadCommittedLocker
extends BuddyLocker

Extends BuddyLocker to acquire write locks using the buddy locker (the transaction locker). This is used for ReadCommitted (Degree 2) isolation.


Field Summary
 
Fields inherited from class com.sleepycat.je.txn.Locker
defaultNoWait, deleteInfo, envImpl, handleLockToHandleMap, handleToHandleLockMap, id, lockManager, readUncommittedDefault, thread
 
Method Summary
 void addDeleteInfo(BIN bin, Key deletedKey)
          Forwards this method to the transactional buddy.
 boolean createdNode(long nodeId)
          Forwards this method to the transactional buddy.
static ReadCommittedLocker createReadCommittedLocker(EnvironmentImpl env, Locker buddy)
           
 long getAbortLsn(long nodeId)
          Forwards this method to the transactional buddy.
 WriteLockInfo getWriteLockInfo(long nodeId)
           
 boolean isReadCommittedIsolation()
          Is always read-committed isolation.
 boolean isTransactional()
          Is always transactional because the buddy locker is transactional.
 Locker newNonTxnLocker()
          Returns a new ReadCommittedLocker that shares locks with this locker by virtue of both lockers only holding READ locks.
 void registerCursor(CursorImpl cursor)
          Forwards this method to the transactional buddy.
 boolean releaseLock(long nodeId)
          Releases the lock from this locker, or if not owned by this locker then releases it from the buddy locker.
 void unRegisterCursor(CursorImpl cursor)
          Forwards this method to the transactional buddy.
 
Methods inherited from class com.sleepycat.je.txn.BuddyLocker
createBuddyLocker, getLockTimeout, getTxnLocker, getTxnTimeout, isTimedOut, releaseNonTxnLocks, setLockTimeout, setTxnTimeout, sharesLocksWith
 
Methods inherited from class com.sleepycat.je.txn.BasicLocker
addLock, checkState, collectStats, createBasicLocker, createBasicLocker, createBasicLocker, generateId, getWriteOwnerLocker, isSerializableIsolation, markDeleteAtTxnEnd, nonTxnOperationEnd, operationEnd, setHandleLockOwner
 
Methods inherited from class com.sleepycat.je.txn.Locker
addToHandleMaps, demoteLock, dumpLockTable, getDefaultNoWait, getId, initApiReadLock, isHandleLockTransferrable, isReadUncommittedDefault, lock, nonBlockingLock, operationEnd, operationEnd, setOnlyAbortable, toString, transferHandleLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

createReadCommittedLocker

public static ReadCommittedLocker createReadCommittedLocker(EnvironmentImpl env,
                                                            Locker buddy)
                                                     throws DatabaseException
Throws:
DatabaseException

newNonTxnLocker

public Locker newNonTxnLocker()
                       throws DatabaseException
Returns a new ReadCommittedLocker that shares locks with this locker by virtue of both lockers only holding READ locks. The buddy locker underlying both ReadCommittedLocker lockers is the same transactional locker, so WRITE locks are also shared.

Overrides:
newNonTxnLocker in class BasicLocker
Throws:
DatabaseException

releaseLock

public boolean releaseLock(long nodeId)
                    throws DatabaseException
Releases the lock from this locker, or if not owned by this locker then releases it from the buddy locker.

Overrides:
releaseLock in class Locker
Throws:
DatabaseException

createdNode

public boolean createdNode(long nodeId)
                    throws DatabaseException
Forwards this method to the transactional buddy. Since the buddy handles write locks, it knows whether this transaction created the node.

Overrides:
createdNode in class BasicLocker
Returns:
true if this transaction created this node, for a operation with transactional semantics.
Throws:
DatabaseException

getAbortLsn

public long getAbortLsn(long nodeId)
                 throws DatabaseException
Forwards this method to the transactional buddy. The buddy handles write locks and therefore handles abort information.

Overrides:
getAbortLsn in class BasicLocker
Returns:
the abort LSN for this node.
Throws:
DatabaseException

getWriteLockInfo

public WriteLockInfo getWriteLockInfo(long nodeId)
                               throws DatabaseException
Overrides:
getWriteLockInfo in class BasicLocker
Returns:
the WriteLockInfo for this node.
Throws:
DatabaseException

addDeleteInfo

public void addDeleteInfo(BIN bin,
                          Key deletedKey)
                   throws DatabaseException
Forwards this method to the transactional buddy. The buddy handles write locks and therefore handles delete information.

Overrides:
addDeleteInfo in class Locker
Throws:
DatabaseException

registerCursor

public void registerCursor(CursorImpl cursor)
                    throws DatabaseException
Forwards this method to the transactional buddy. The buddy Txn tracks cursors.

Overrides:
registerCursor in class BasicLocker
Throws:
DatabaseException

unRegisterCursor

public void unRegisterCursor(CursorImpl cursor)
                      throws DatabaseException
Forwards this method to the transactional buddy. The buddy Txn tracks cursors.

Overrides:
unRegisterCursor in class BasicLocker
Throws:
DatabaseException

isTransactional

public boolean isTransactional()
Is always transactional because the buddy locker is transactional.

Overrides:
isTransactional in class BasicLocker

isReadCommittedIsolation

public boolean isReadCommittedIsolation()
Is always read-committed isolation.

Overrides:
isReadCommittedIsolation in class BasicLocker