com.sleepycat.je.rep.txn
Class ReplicaThreadLocker
java.lang.Object
com.sleepycat.je.txn.Locker
com.sleepycat.je.txn.BasicLocker
com.sleepycat.je.txn.ThreadLocker
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.
Method Summary |
void |
disallowReplicaWrite()
Unconditionally throws ReplicaWriteException because this locker was
created on a replica. |
boolean |
isReplicationDefined()
Used for debugging checks to ensure that replication-defined lockers are
used for accessing replicated databases. |
LockResult |
lockInternal(long lsn,
LockType lockType,
boolean noWait,
boolean jumpAheadOfWaiters,
DatabaseImpl database)
This overridden method prevents writes on a replica. |
void |
openCursorHook(DatabaseImpl dbImpl)
Verifies that consistency requirements are met before allowing the
cursor to be opened. |
void |
preLogWithoutLock(DatabaseImpl database)
If logging occurs before locking, we must screen out write locks here. |
Methods inherited from class com.sleepycat.je.txn.BasicLocker |
addLock, collectStats, createBasicLocker, createBasicLocker, createdNode, generateId, getTxnLocker, getWriteLockInfo, getWriteOwnerLocker, isReadCommittedIsolation, isSerializableIsolation, isTransactional, lockingRequired, markDeleteAtTxnEnd, nonTxnOperationEnd, operationEnd, registerCursor, releaseNonTxnLocks, unRegisterCursor |
Methods inherited from class com.sleepycat.je.txn.Locker |
addDeleteInfo, addOpenedDatabase, allowReleaseLockAfterLsnChange, demoteLock, dumpLockTable, getDefaultNoWait, getEnvironment, getId, getImportunate, getInitialLockTimeout, getLockTimeout, getPreemptable, getTransaction, getTxnTimeout, isReadUncommittedDefault, isRolledBack, isTimedOut, isValid, lock, nonBlockingLock, operationEnd, operationEnd, releaseLock, setClosingLocker, setImportunate, setLockTimeout, setOnlyAbortable, setPreemptable, setPreempted, setTxnTimeout, toString |
ReplicaThreadLocker
public ReplicaThreadLocker(RepImpl repImpl)
lockInternal
public LockResult lockInternal(long lsn,
LockType lockType,
boolean noWait,
boolean jumpAheadOfWaiters,
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:
lsn
- 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.jumpAheadOfWaiters
- grant the lock before other waiters, if any.database
- is the database containing lsn.
preLogWithoutLock
public void preLogWithoutLock(DatabaseImpl database)
- If logging occurs before locking, we must screen out write locks here.
- Overrides:
preLogWithoutLock
in class BasicLocker
disallowReplicaWrite
public void disallowReplicaWrite()
- Unconditionally throws ReplicaWriteException because this locker was
created on a replica.
- Overrides:
disallowReplicaWrite
in class Locker
openCursorHook
public void openCursorHook(DatabaseImpl dbImpl)
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-2012 Oracle. All rights reserved.