Class RowLocking2nohold
- java.lang.Object
-
- org.apache.derby.impl.store.raw.xact.NoLocking
-
- org.apache.derby.impl.store.raw.xact.RowLocking3
-
- org.apache.derby.impl.store.raw.xact.RowLockingRR
-
- org.apache.derby.impl.store.raw.xact.RowLocking2
-
- org.apache.derby.impl.store.raw.xact.RowLocking2nohold
-
- All Implemented Interfaces:
LockingPolicy
public class RowLocking2nohold extends RowLocking2
A locking policy that implements row level locking with isolation degree 2, never holding read locks after they are granted. Exactly the same as RowLocking2, except that read locks are acquired using zeroDuration locks, which are immediately released by the lock manager after they are granted.- See Also:
LockingPolicy
-
-
Field Summary
-
Fields inherited from class org.apache.derby.impl.store.raw.xact.RowLocking3
lf
-
Fields inherited from interface org.apache.derby.iapi.store.raw.LockingPolicy
MODE_CONTAINER, MODE_NONE, MODE_RECORD
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RowLocking2nohold(LockFactory lf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
lockRecordForRead(Transaction t, ContainerHandle container_handle, RecordHandle record, boolean waitForLock, boolean forUpdate)
Obtain lock on record being read.void
unlockRecordAfterRead(Transaction t, ContainerHandle container_handle, RecordHandle record, boolean forUpdate, boolean row_qualified)
Unlock a record after it has been locked for read.-
Methods inherited from class org.apache.derby.impl.store.raw.xact.RowLocking2
lockContainer, unlockContainer
-
Methods inherited from class org.apache.derby.impl.store.raw.xact.RowLockingRR
getReadLockType, getUpdateLockType, getWriteLockType
-
Methods inherited from class org.apache.derby.impl.store.raw.xact.RowLocking3
getMode, lockRecordForWrite, zeroDurationLockRecordForWrite
-
-
-
-
Constructor Detail
-
RowLocking2nohold
protected RowLocking2nohold(LockFactory lf)
-
-
Method Detail
-
lockRecordForRead
public boolean lockRecordForRead(Transaction t, ContainerHandle container_handle, RecordHandle record, boolean waitForLock, boolean forUpdate) throws StandardException
Obtain lock on record being read.Assumes that a table level IS has been acquired. Will acquire a Shared or Update lock on the row, depending on the "forUpdate" parameter.
Read lock will be acquired using zeroDuration lock.
- Specified by:
lockRecordForRead
in interfaceLockingPolicy
- Overrides:
lockRecordForRead
in classRowLocking2
- Parameters:
t
- The transaction to associate the lock with.record
- The record to be locked.waitForLock
- Should lock request wait until granted?forUpdate
- Whether to open for read or write access.container_handle
- Open Container used to get record. Will be used to row locks by the container they belong to.- Returns:
- true if the lock was granted, false if waitForLock was false and the lock could not be granted.
- Throws:
StandardException
- Standard exception policy.- See Also:
Page
-
unlockRecordAfterRead
public void unlockRecordAfterRead(Transaction t, ContainerHandle container_handle, RecordHandle record, boolean forUpdate, boolean row_qualified)
Description copied from class:RowLockingRR
Unlock a record after it has been locked for read.In repeatable read only unlock records which "did not qualify". For example in a query like "select * from foo where a = 1" on a table with no index it is only necessary to hold locks on rows where a=1, but in the process of finding those rows the system will get locks on other rows to verify they are committed before applying the qualifier. Those locks can be released under repeatable read isolation.
- Specified by:
unlockRecordAfterRead
in interfaceLockingPolicy
- Overrides:
unlockRecordAfterRead
in classRowLocking2
- See Also:
Page
-
-