private final class RecordLockContext.Perm.LockState
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<RecordBuffer> |
buffers
Buffers who share this lock state
|
private LockType |
currentType
Lock type currently assigned to the record
|
private RecordIdentifier<java.lang.String> |
ident
Database record whose lock state is being tracked
|
| Constructor and Description |
|---|
LockState(RecordIdentifier<java.lang.String> ident)
Constructor which queries current lock type for a record from the lock manager.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o)
Override parent's implementation of equality.
|
(package private) LockType |
getCurrentType()
Get the current lock type.
|
(package private) RecordIdentifier<java.lang.String> |
getIdentifier()
Get record's unique identifier.
|
int |
hashCode()
Override parent's implementation to be consistent with
equals(Object). |
(package private) boolean |
registerBuffer(RecordBuffer buffer)
Register a record buffer which shares access to the record's
current lock.
|
(package private) void |
relinquish(LockType requestedType)
Attempt to relinquish the lock represented by this object, releasing or downgrading
it if possible.
|
(package private) void |
setCurrentType(LockType currentType)
Set the current lock type.
|
(package private) void |
transactionEnded()
Process any pending lock change which has been deferred during the most recent
application level transaction.
|
private void |
updateLock(LockType lockType)
Attempt to update the current lock on the record immediately.
|
private final RecordIdentifier<java.lang.String> ident
private final java.util.List<RecordBuffer> buffers
private LockType currentType
LockState(RecordIdentifier<java.lang.String> ident)
ident - Unique identifier for the database record whose lock
type is to be queried from the lock manager.public int hashCode()
equals(Object).hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - Another instance of this class to test for equality with
this instance.true if this object and the given instance
have the same record identifier, else false.boolean registerBuffer(RecordBuffer buffer)
buffer - Record buffer to be registered.true if the buffer was added;
false if it was previously registered.RecordIdentifier<java.lang.String> getIdentifier()
LockType getCurrentType()
void setCurrentType(LockType currentType)
currentType - Current type to be set. Only the category is used
(i.e., NONE, SHARE, EXCLUSIVE); the no-wait-"ness" of
the lock type is discarded.void transactionEnded()
throws LockUnavailableException
LockUnavailableException - never, since we are never acquiring a more restrictive lock, only
downgrading or releasing.void relinquish(LockType requestedType) throws LockUnavailableException
requestedType - NONE or SHARE only (it doesn't make sense to downgrade to EXCLUSIVE).java.lang.IllegalArgumentException - if an EXCLUSIVE lock is requested.LockUnavailableException - never, since we never request a no-wait lock here.private void updateLock(LockType lockType) throws LockUnavailableException
lockType - Requested lock type. If NONE, this object will be
removed from the map of lock states by identifier.LockUnavailableException - never.