| org.apache.derby.iapi.store.raw.LockingPolicy
All known Subclasses: org.apache.derby.impl.store.raw.xact.NoLocking,
LockingPolicy | public interface LockingPolicy (Code) | | Any object that implements this interface can be used as a locking
policy for accessing a container.
The locking policy must use the defined lock qualifiers
(ContainerLock.CIS, RowLock.RS, etc.) and the standard lock manager.
(A locking policy that just performs no locking wouldn't need to use
these :-)
A locking policy must use the object that is an instance of Transaction
(originally obtained via startTransaction() in RawStoreFactory) as the
compatibilitySpace for the LockFactory calls.
A locking policy must use the passed in transaction as the
compatability space and the lock group.
This chain (group) of locks has the following defined behaviour
- Locks are released at transaction.commit()
- Locks are released at transaction.abort()
MT - Thread Safe
See Also: ContainerHandle See Also: RecordHandle See Also: org.apache.derby.iapi.services.locks.LockFactory See Also: org.apache.derby.iapi.services.locks.Lockable |
Field Summary | |
final static int | MODE_CONTAINER ContainerHandle level locking. | final static int | MODE_NONE No locking what so ever, isolation parameter will be ignored by
getLockingPolicy(). | final static int | MODE_RECORD Record level locking. |
Method Summary | |
public int | getMode() | public boolean | lockContainer(Transaction t, ContainerHandle container, boolean waitForLock, boolean forUpdate) Called when a container is opened.
Parameters: t - Transaction to associate lock with. Parameters: container - Container to lock. Parameters: waitForLock - Should lock request wait until granted? Parameters: forUpdate - Should container be locked for update, or read? true if the lock was obtained, false if it wasn't. | public boolean | lockRecordForRead(Transaction t, ContainerHandle container, RecordHandle record, boolean waitForLock, boolean forUpdate) Called before a record is fetched.
Parameters: t - Transaction to associate lock with. Parameters: container - Open Container used to get record. | public void | lockRecordForRead(Latch latch, RecordHandle record, boolean forUpdate) Lock a record while holding a page latch. | public boolean | lockRecordForWrite(Transaction t, RecordHandle record, boolean lockForInsert, boolean waitForLock) Called before a record is inserted, updated or deleted.
If zeroDuration is true then lock is released immediately after it
has been granted.
Parameters: t - Transaction to associate lock with. Parameters: record - Record to lock. Parameters: lockForInsert - Lock is for an insert. Parameters: waitForLock - Should lock request wait until granted? true if the lock was obtained, false if it wasn't. | public void | lockRecordForWrite(Latch latch, RecordHandle record) Lock a record for write while holding a page latch. | public void | unlockContainer(Transaction t, ContainerHandle container) Called when a container is closed. | public void | unlockRecordAfterRead(Transaction t, ContainerHandle container, RecordHandle record, boolean forUpdate, boolean row_qualified) Called after a record has been fetched. | public boolean | zeroDurationLockRecordForWrite(Transaction t, RecordHandle record, boolean lockForPreviousKey, boolean waitForLock) Request a write lock which will be released immediately upon grant.
Parameters: t - Transaction to associate lock with. Parameters: record - Record to lock. Parameters: lockForPreviousKey - Lock is for a previous key of a insert. Parameters: waitForLock - Should lock request wait until granted? true if the lock was obtained, false if it wasn't. |
MODE_CONTAINER | final static int MODE_CONTAINER(Code) | | ContainerHandle level locking.
|
MODE_NONE | final static int MODE_NONE(Code) | | No locking what so ever, isolation parameter will be ignored by
getLockingPolicy().
See Also: RawStoreFactory |
MODE_RECORD | final static int MODE_RECORD(Code) | | Record level locking.
|
getMode | public int getMode()(Code) | | Get the mode of this policy
|
lockContainer | public boolean lockContainer(Transaction t, ContainerHandle container, boolean waitForLock, boolean forUpdate) throws StandardException(Code) | | Called when a container is opened.
Parameters: t - Transaction to associate lock with. Parameters: container - Container to lock. Parameters: waitForLock - Should lock request wait until granted? Parameters: forUpdate - Should container be locked for update, or read? 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. exception: StandardException - Standard Cloudscape error policy See Also: ContainerHandle |
lockRecordForRead | public boolean lockRecordForRead(Transaction t, ContainerHandle container, RecordHandle record, boolean waitForLock, boolean forUpdate) throws StandardException(Code) | | Called before a record is fetched.
Parameters: t - Transaction to associate lock with. Parameters: container - Open Container used to get record. Will be usedto row locks by the container they belong to. Parameters: record - Record to lock. Parameters: waitForLock - Should lock request wait until granted? Parameters: forUpdate - Should container be locked for update, or read? exception: StandardException - Standard Cloudscape error policy See Also: Page |
lockRecordForRead | public void lockRecordForRead(Latch latch, RecordHandle record, boolean forUpdate) throws StandardException(Code) | | Lock a record while holding a page latch.
Parameters: latch - Latch held. Parameters: record - Record to lock. Parameters: forUpdate - Should container be locked for update, or read? exception: StandardException - Standard Cloudscape error policy See Also: Page |
lockRecordForWrite | public boolean lockRecordForWrite(Transaction t, RecordHandle record, boolean lockForInsert, boolean waitForLock) throws StandardException(Code) | | Called before a record is inserted, updated or deleted.
If zeroDuration is true then lock is released immediately after it
has been granted.
Parameters: t - Transaction to associate lock with. Parameters: record - Record to lock. Parameters: lockForInsert - Lock is for an insert. Parameters: waitForLock - Should lock request wait until granted? 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. exception: StandardException - Standard Cloudscape error policy See Also: Page |
lockRecordForWrite | public void lockRecordForWrite(Latch latch, RecordHandle record) throws StandardException(Code) | | Lock a record for write while holding a page latch.
Parameters: latch - Page latch held. Parameters: record - Record to lock. exception: StandardException - Standard Cloudscape error policy See Also: Page |
zeroDurationLockRecordForWrite | public boolean zeroDurationLockRecordForWrite(Transaction t, RecordHandle record, boolean lockForPreviousKey, boolean waitForLock) throws StandardException(Code) | | Request a write lock which will be released immediately upon grant.
Parameters: t - Transaction to associate lock with. Parameters: record - Record to lock. Parameters: lockForPreviousKey - Lock is for a previous key of a insert. Parameters: waitForLock - Should lock request wait until granted? 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. exception: StandardException - Standard Cloudscape error policy See Also: Page |
|
|