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, lockTimeOutMillis, readUncommittedDefault, thread
 
Constructor Summary
ReadCommittedLocker(EnvironmentImpl env, Locker buddy)
          Creates a ReadCommittedLocker.
 
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.
 boolean getAbortKnownDeleted(long nodeId)
          Forwards this method to the transactional buddy.
 long getAbortLsn(long nodeId)
          Forwards this method to the transactional buddy.
 boolean isReadCommittedIsolation()
          Is always read-committed isolation.
 boolean isTransactional()
          Is always transactional because the buddy locker is transactional.
 LockResult lock(long nodeId, LockType lockType, DatabaseImpl database)
          Forwards write locks to the buddy locker (the transaction locker).
 Locker newNonTxnLocker()
          Creates a new instance of this txn for the same environment.
 void registerCursor(CursorImpl cursor)
          Forwards this method to the transactional buddy.
 void 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
getBuddy, getTxnLocker, releaseNonTxnLocks, sharesLocksWith
 
Methods inherited from class com.sleepycat.je.txn.BasicLocker
addLock, checkState, collectStats, generateId, getOwnerAbortLsn, getWriteOwnerLocker, isSerializableIsolation, markDeleteAtTxnEnd, moveWriteToReadLock, nonBlockingReadLock, operationEnd, operationEnd, removeLock, setHandleLockOwner
 
Methods inherited from class com.sleepycat.je.txn.Locker
addToHandleMaps, demoteLock, dumpLockTable, getId, getLockTimeout, getTxnStartMillis, getTxnTimeOut, getWaitingFor, isHandleLockTransferrable, isReadUncommittedDefault, isTimedOut, operationEnd, 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

ReadCommittedLocker

public ReadCommittedLocker(EnvironmentImpl env,
                           Locker buddy)
                    throws DatabaseException
Creates a ReadCommittedLocker.

Parameters:
buddy - is a transactional locker that will be used for acquiring write locks.
Throws:
DatabaseException
Method Detail

newNonTxnLocker

public Locker newNonTxnLocker()
                       throws DatabaseException
Creates a new instance of this txn for the same environment. No transactional locks are held by this object, so no locks are retained. newNonTxnLocker is also called for the BuddyLocker.

Overrides:
newNonTxnLocker in class BuddyLocker
Throws:
DatabaseException

lock

public LockResult lock(long nodeId,
                       LockType lockType,
                       DatabaseImpl database)
                throws DatabaseException
Forwards write locks to the buddy locker (the transaction locker).

Overrides:
lock in class BasicLocker
Throws:
DatabaseException

releaseLock

public void 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

getAbortKnownDeleted

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

Overrides:
getAbortKnownDeleted in class BasicLocker
Returns:
the abort known deleted state 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


Copyright 2004-2005 Sleepycat, Inc. All Rights Reserved.