private class RecordBuffer.PinnedLocks
extends java.lang.Object
RecordLockContext
to manage the communal locks held by the current user session.
When outside a transaction, only the lock type for the current record held by the buffer, if any, is tracked. It only can be a SHARE lock or none at all.
When inside a transaction, the most restrictive lock type for every record which passes through the buffer is tracked. Once a lock is acquired, it is not downgraded or released until the transaction ends.
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<java.lang.Long,LockType> |
inTrans
The pinned lock types for all records used by this buffer in the current transaction
|
private long |
lastXactCount
Transaction count at last check, used for comparison to see if we are in a different transaction
|
private LockType |
noTrans
The pinned lock type for the current record, if any, when not in a transaction
|
Modifier | Constructor and Description |
---|---|
private |
PinnedLocks() |
Modifier and Type | Method and Description |
---|---|
(package private) void |
closeScope()
Clean up when the buffer closes its outermost scope.
|
(package private) LockType |
getPinnedLockType(java.lang.Long id)
Get the pinned lock type for the record with the given primary key.
|
private boolean |
manageTransactionState()
Manage the internal state of this object, based on the current application transaction state.
|
(package private) void |
setPinnedLockType(java.lang.Long id,
LockType lockType)
Set the pinned lock type for the record with the given primary key.
|
private LockType noTrans
private java.util.HashMap<java.lang.Long,LockType> inTrans
private long lastXactCount
LockType getPinnedLockType(java.lang.Long id)
id
- Primary key.void setPinnedLockType(java.lang.Long id, LockType lockType)
id
- Primary key.lockType
- Lock type to set.void closeScope()
private boolean manageTransactionState()
true
if an application transaction is active, else false
.