com.sleepycat.je.rep.txn
Class ReplicaThreadLocker

java.lang.Object
  extended by com.sleepycat.je.txn.Locker
      extended by com.sleepycat.je.txn.BasicLocker
          extended by com.sleepycat.je.txn.ThreadLocker
              extended by com.sleepycat.je.rep.txn.ReplicaThreadLocker

public class ReplicaThreadLocker
extends ThreadLocker

A ReplicaThreadLocker is used with a user initiated non-transactional operation on a Replica. Like ReadonlyTxn, it enforces read-only semantics and implements the ReplicaConsistencyPolicy. Unlike ReadonlyTxn, the environment default ReplicaConsistencyPolicy is enforced rather than the policy specified via TransactionConfig, and this policy is enforced via the openCursorHook rather than the txnBeginHook.


Field Summary
 
Fields inherited from class com.sleepycat.je.txn.Locker
defaultNoWait, deleteInfo, envImpl, handleLockToHandleMap, handleToHandleLockMap, id, lockManager, readUncommittedDefault, thread
 
Constructor Summary
ReplicaThreadLocker(RepImpl repImpl)
           
 
Method Summary
 boolean isReplicationDefined()
          Used for debugging checks to ensure that replication-defined lockers are used for accessing replicated databases.
 LockResult lockInternal(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database)
          This overridden method prevents writes on a replica.
 void openCursorHook()
          Verifies that consistency requirements are met before allowing the cursor to be opened.
 
Methods inherited from class com.sleepycat.je.txn.ThreadLocker
checkState, createThreadLocker, newNonTxnLocker, sharesLocksWith
 
Methods inherited from class com.sleepycat.je.txn.BasicLocker
addLock, collectStats, createBasicLocker, createBasicLocker, createdNode, generateId, getAbortLsn, getTxnLocker, getWriteLockInfo, getWriteOwnerLocker, isReadCommittedIsolation, isSerializableIsolation, isTransactional, lockingRequired, markDeleteAtTxnEnd, nonTxnOperationEnd, operationEnd, registerCursor, releaseNonTxnLocks, setHandleLockOwner, unRegisterCursor
 
Methods inherited from class com.sleepycat.je.txn.Locker
addDeleteInfo, addToHandleMaps, demoteLock, dumpLockTable, getDefaultNoWait, getId, getImportunate, getInitialLockTimeout, getLockTimeout, getPreemptable, getTxnTimeout, isHandleLockTransferrable, isReadUncommittedDefault, isRolledBack, isTimedOut, lock, nonBlockingLock, operationEnd, operationEnd, releaseLock, setClosingLocker, setImportunate, setLockTimeout, setOnlyAbortable, setPreemptable, setPreempted, setTxnTimeout, toString, transferHandleLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReplicaThreadLocker

public ReplicaThreadLocker(RepImpl repImpl)
Method Detail

lockInternal

public LockResult lockInternal(long nodeId,
                               LockType lockType,
                               boolean noWait,
                               DatabaseImpl database)
This overridden method prevents writes on a replica. This check is redundant because Cursor won't allow writes to a transactional database when no Transaction is specified. But we check here also for safety and for consistency with ReadonlyTxn.

Overrides:
lockInternal in class BasicLocker
Parameters:
nodeId - is the node to lock.
lockType - is the type of lock to request.
noWait - is true to override the defaultNoWait setting. If true, or if defaultNoWait is true, throws LockNotAvailableException if the lock cannot be granted without waiting.
database - is the database containing nodeId.

openCursorHook

public void openCursorHook()
                    throws ReplicaConsistencyException
Verifies that consistency requirements are met before allowing the cursor to be opened.

Overrides:
openCursorHook in class Locker
Throws:
ReplicaConsistencyException

isReplicationDefined

public boolean isReplicationDefined()
Description copied from class: Locker
Used for debugging checks to ensure that replication-defined lockers are used for accessing replicated databases. Overridden by replicated-defined lockers to return true.

Overrides:
isReplicationDefined in class Locker


Copyright (c) 2004-2010 Oracle. All rights reserved.