public class BasicLocker extends Locker
defaultNoWait, deleteInfo, envImpl, id, lockManager, readUncommittedDefault, thread
Modifier | Constructor and Description |
---|---|
protected |
BasicLocker(EnvironmentImpl env)
Creates a BasicLocker.
|
protected |
BasicLocker(EnvironmentImpl env,
boolean noWait)
Creates a BasicLocker with a noWait argument.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addLock(java.lang.Long lsn,
LockType type,
LockGrantType grantStatus)
Add a lock to set owned by this transaction.
|
protected void |
checkState(boolean ignoreCalledByAbort) |
StatGroup |
collectStats()
Stats.
|
static BasicLocker |
createBasicLocker(EnvironmentImpl env) |
static BasicLocker |
createBasicLocker(EnvironmentImpl env,
boolean noWait) |
boolean |
createdNode(long lsn)
Always false for this txn.
|
protected long |
generateId(TxnManager txnManager,
long ignore)
BasicLockers always have a fixed id, because they are never used for
recovery.
|
Txn |
getTxnLocker()
No transactional locker is available.
|
WriteLockInfo |
getWriteLockInfo(long lsn) |
Locker |
getWriteOwnerLocker(long lsn)
Get the txn that owns the lock on this node.
|
boolean |
isReadCommittedIsolation()
Is never read-committed isolation.
|
boolean |
isSerializableIsolation()
Is never serializable isolation.
|
boolean |
isTransactional()
Is never transactional.
|
boolean |
lockingRequired()
Returns true if locking is required for this Locker.
|
protected LockResult |
lockInternal(long lsn,
LockType lockType,
boolean noWait,
boolean jumpAheadOfWaiters,
DatabaseImpl database)
Abstract method to a blocking or non-blocking lock of the given type on
the given LSN.
|
void |
markDeleteAtTxnEnd(DatabaseImpl db,
boolean deleteAtCommit)
Database operations like remove and truncate leave behind
residual DatabaseImpls that must be purged at transaction
commit or abort.
|
(package private) void |
moveWriteToReadLock(long lsn,
Lock lock)
A lock is being demoted.
|
Locker |
newNonTxnLocker()
Throws EnvironmentFailureException unconditionally.
|
void |
nonTxnOperationEnd()
Release locks and close the cursor at the end of the operation.
|
void |
operationEnd(boolean operationOK)
Release locks and close the cursor at the end of the operation.
|
void |
preLogWithoutLock(DatabaseImpl database)
In the case where logging occurs before locking, we must ensure that
we're prepared to undo if logging succeeds but locking fails.
|
void |
registerCursor(CursorImpl cursor)
This txn doesn't store cursors.
|
void |
releaseNonTxnLocks()
Releases all locks, since all locks held by this locker are
non-transactional.
|
(package private) void |
removeLock(long lsn)
Remove a lock from the set owned by this txn.
|
void |
unRegisterCursor(CursorImpl cursor)
This txn doesn't store cursors.
|
addBuddy, addDeleteInfo, addOpenedDatabase, allowReleaseLockAfterLsnChange, checkPreempted, close, demoteLock, disallowReplicaWrite, dumpLockTable, getDefaultNoWait, getEnvironment, getId, getImportunate, getInitialLockTimeout, getLockTimeout, getPreemptable, getTransaction, getTxnStartMillis, getTxnTimeout, getWaitingFor, isPreempted, isReadUncommittedDefault, isReplicationDefined, isRolledBack, isTimedOut, isValid, lock, lockAfterLsnChange, nonBlockingLock, openCursorHook, operationEnd, operationEnd, releaseLock, removeBuddy, setAllowMultithreadedAccess, setClosingLocker, setImportunate, setLockTimeout, setOnlyAbortable, setPreemptable, setPreempted, setTxnTimeout, setWaitingFor, sharesLocksWith, throwIfPreempted, toString
protected BasicLocker(EnvironmentImpl env)
protected BasicLocker(EnvironmentImpl env, boolean noWait)
public static BasicLocker createBasicLocker(EnvironmentImpl env) throws DatabaseException
DatabaseException
public static BasicLocker createBasicLocker(EnvironmentImpl env, boolean noWait) throws DatabaseException
DatabaseException
protected long generateId(TxnManager txnManager, long ignore)
generateId
in class Locker
protected void checkState(boolean ignoreCalledByAbort)
checkState
in class Locker
protected LockResult lockInternal(long lsn, LockType lockType, boolean noWait, boolean jumpAheadOfWaiters, DatabaseImpl database) throws DatabaseException
Locker
lockInternal
in class Locker
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.LockConflictException
- if a blocking lock could not be acquired.DatabaseException
public void preLogWithoutLock(DatabaseImpl database)
Locker
preLogWithoutLock
in class Locker
public Locker getWriteOwnerLocker(long lsn) throws DatabaseException
DatabaseException
public boolean isTransactional()
isTransactional
in class Locker
public boolean isSerializableIsolation()
isSerializableIsolation
in class Locker
public boolean isReadCommittedIsolation()
isReadCommittedIsolation
in class Locker
public Txn getTxnLocker()
getTxnLocker
in class Locker
public Locker newNonTxnLocker() throws DatabaseException
newNonTxnLocker
in class Locker
DatabaseException
- from subclasses.public void releaseNonTxnLocks() throws DatabaseException
releaseNonTxnLocks
in class Locker
DatabaseException
public void nonTxnOperationEnd() throws DatabaseException
nonTxnOperationEnd
in class Locker
DatabaseException
public void operationEnd(boolean operationOK) throws DatabaseException
operationEnd
in class Locker
operationOK
- is whether the operation succeeded, since
that may impact ending behavior. (i.e for an auto Txn)DatabaseException
public void registerCursor(CursorImpl cursor)
registerCursor
in class Locker
DatabaseException
- in subclasses.public void unRegisterCursor(CursorImpl cursor)
unRegisterCursor
in class Locker
public boolean lockingRequired()
Locker
lockingRequired
in class Locker
public WriteLockInfo getWriteLockInfo(long lsn)
getWriteLockInfo
in class Locker
public void markDeleteAtTxnEnd(DatabaseImpl db, boolean deleteAtCommit) throws DatabaseException
Locker
markDeleteAtTxnEnd
in class Locker
DatabaseException
protected void addLock(java.lang.Long lsn, LockType type, LockGrantType grantStatus)
void removeLock(long lsn)
removeLock
in class Locker
public boolean createdNode(long lsn)
createdNode
in class Locker
void moveWriteToReadLock(long lsn, Lock lock)
moveWriteToReadLock
in class Locker
public StatGroup collectStats() throws DatabaseException
collectStats
in class Locker
DatabaseException
Copyright (c) 2004-2012 Oracle. All rights reserved.