org.apache.derby.impl.store.raw.xact
Class RowLocking3Escalate
- java.lang.Object
-
- org.apache.derby.impl.store.raw.xact.ContainerLocking3
-
- org.apache.derby.impl.store.raw.xact.RowLocking3Escalate
-
- All Implemented Interfaces:
- LockingPolicy
public class RowLocking3Escalate extends ContainerLocking3
A locking policy that implements row level locking with isolation degree 3.- See Also:
LockingPolicy
-
-
Field Summary
-
Fields inherited from interface org.apache.derby.iapi.store.raw.LockingPolicy
MODE_CONTAINER, MODE_NONE, MODE_RECORD
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanlockContainer(Transaction t, ContainerHandle container, boolean waitForLock, boolean forUpdate)Escalates Row Locking 3 to Container Locking 3.booleanlockRecordForRead(Transaction t, ContainerHandle container, RecordHandle record, boolean waitForLock, boolean forUpdate)Called before a record is fetched.booleanlockRecordForWrite(Transaction t, RecordHandle record, boolean lockForInsert, boolean waitForLock)Called before a record is inserted, updated or deleted.voidunlockContainer(Transaction t, ContainerHandle container)Called when a container is closed.voidunlockRecordAfterRead(Transaction t, ContainerHandle container, RecordHandle record, boolean forUpdate, boolean row_qualified)Called after a record has been fetched.booleanzeroDurationLockRecordForWrite(Transaction t, RecordHandle record, boolean lockForPreviousKey, boolean waitForLock)Request a write lock which will be released immediately upon grant.-
Methods inherited from class org.apache.derby.impl.store.raw.xact.ContainerLocking3
getMode
-
-
-
-
Method Detail
-
lockContainer
public boolean lockContainer(Transaction t, ContainerHandle container, boolean waitForLock, boolean forUpdate) throws StandardException
Escalates Row Locking 3 to Container Locking 3.This call is made by code which tracks the number of locks on a container. When the number of locks exceeds the escalate threshold the caller creates this new locking policy, calls lockContainer(), and substitues it for the old locking policy. The lockContainer call determines which table lock to get (S or X), gets that table lock, and then releases the row locks on the table. It is assumed that this is called on a open container for lock only.
- Specified by:
lockContainerin interfaceLockingPolicy- Overrides:
lockContainerin classContainerLocking3- Parameters:
t- Transaction to associate lock with.container- Container to lock.waitForLock- Ignored - will never wait for a lock.forUpdate- Ignored, mode determined from current lock state.- Returns:
- true if the lock was obtained, false if it wasn't. False should only be returned if the waitForLock policy was set to "false," and the lock was unavailable.
- Throws:
StandardException- Standard exception policy.- See Also:
ContainerHandle
-
unlockContainer
public void unlockContainer(Transaction t, ContainerHandle container)
Description copied from interface:LockingPolicyCalled when a container is closed.- Specified by:
unlockContainerin interfaceLockingPolicy- See Also:
ContainerHandle,ContainerHandle.close()
-
lockRecordForRead
public boolean lockRecordForRead(Transaction t, ContainerHandle container, RecordHandle record, boolean waitForLock, boolean forUpdate) throws StandardException
Description copied from interface:LockingPolicyCalled before a record is fetched.- Specified by:
lockRecordForReadin interfaceLockingPolicy- Parameters:
t- Transaction to associate lock with.container- Open Container used to get record. Will be used to row locks by the container they belong to.record- Record to lock.waitForLock- Should lock request wait until granted?forUpdate- Should container be locked for update, or read?- Throws:
StandardException- Standard Derby error policy- See Also:
Page
-
zeroDurationLockRecordForWrite
public boolean zeroDurationLockRecordForWrite(Transaction t, RecordHandle record, boolean lockForPreviousKey, boolean waitForLock) throws StandardException
Description copied from interface:LockingPolicyRequest a write lock which will be released immediately upon grant.- Specified by:
zeroDurationLockRecordForWritein interfaceLockingPolicy- Parameters:
t- Transaction to associate lock with.record- Record to lock.lockForPreviousKey- Lock is for a previous key of a insert.waitForLock- Should lock request wait until granted?- Returns:
- true if the lock was obtained, false if it wasn't. False should only be returned if the waitForLock argument was set to "false," and the lock was unavailable.
- Throws:
StandardException- Standard Derby error policy- See Also:
Page
-
lockRecordForWrite
public boolean lockRecordForWrite(Transaction t, RecordHandle record, boolean lockForInsert, boolean waitForLock) throws StandardException
Description copied from interface:LockingPolicyCalled before a record is inserted, updated or deleted. If zeroDuration is true then lock is released immediately after it has been granted.- Specified by:
lockRecordForWritein interfaceLockingPolicy- Parameters:
t- Transaction to associate lock with.record- Record to lock.lockForInsert- Lock is for an insert.waitForLock- Should lock request wait until granted?- Returns:
- true if the lock was obtained, false if it wasn't. False should only be returned if the waitForLock argument was set to "false," and the lock was unavailable.
- Throws:
StandardException- Standard Derby error policy- See Also:
Page
-
unlockRecordAfterRead
public void unlockRecordAfterRead(Transaction t, ContainerHandle container, RecordHandle record, boolean forUpdate, boolean row_qualified) throws StandardException
Description copied from interface:LockingPolicyCalled after a record has been fetched.- Specified by:
unlockRecordAfterReadin interfaceLockingPolicy- Throws:
StandardException- Standard Derby error policy- See Also:
Page
-
-
DataMelt 3.0 © DataMelt by jWork.ORG