org.apache.derby.impl.store.raw.xact
Class RowLockingRR

java.lang.Object
  extended by org.apache.derby.impl.store.raw.xact.NoLocking
      extended by org.apache.derby.impl.store.raw.xact.RowLocking3
          extended by org.apache.derby.impl.store.raw.xact.RowLockingRR
All Implemented Interfaces:
LockingPolicy
Direct Known Subclasses:
RowLocking2

public class RowLockingRR
extends RowLocking3

A locking policy that implements row level locking with repeatable read isolation. Since phantom protection with previous key locking is actually handled by the upper level access methods, the only difference in repeatable read is that read locks are of type RowLock.RS2. This type will not conflict with a previous key insert lock.

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
protected RowLockingRR(LockFactory lf)
           
 
Method Summary
protected  RowLock getReadLockType()
          Get type of lock to get while reading data.
protected  RowLock getUpdateLockType()
          Get type of lock to get while requesting "update" lock.
protected  RowLock getWriteLockType()
          Get type of lock to get while writing data.
 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.RowLocking3
getMode, lockContainer, lockRecordForRead, lockRecordForWrite, zeroDurationLockRecordForWrite
 
Methods inherited from class org.apache.derby.impl.store.raw.xact.NoLocking
unlockContainer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowLockingRR

protected RowLockingRR(LockFactory lf)
Method Detail

getReadLockType

protected RowLock getReadLockType()
Description copied from class: RowLocking3
Get type of lock to get while reading data.

This routine is provided so that class's like RowLockingRR can override just this routine to get RS2 locks vs RS3 locks, and still reuse all the other code in this class.

Overrides:
getReadLockType in class RowLocking3
Returns:
The lock type of a shared lock for this locking policy.

getUpdateLockType

protected RowLock getUpdateLockType()
Description copied from class: RowLocking3
Get type of lock to get while requesting "update" lock.

This routine is provided so that class's like RowLockingRR can override just this routine to get RU2 locks vs RU3 locks, and still reuse all the other code in this class.

Overrides:
getUpdateLockType in class RowLocking3
Returns:
The lock type of a shared lock for this locking policy.

getWriteLockType

protected RowLock getWriteLockType()
Description copied from class: RowLocking3
Get type of lock to get while writing data.

This routine is provided so that class's like RowLockingRR can override just this routine to get RX2 locks vs RX3 locks, and still reuse all the other code in this class.

Overrides:
getWriteLockType in class RowLocking3
Returns:
The lock type of a shared lock for this locking policy.

unlockRecordAfterRead

public void unlockRecordAfterRead(Transaction t,
                                  ContainerHandle container_handle,
                                  RecordHandle record,
                                  boolean forUpdate,
                                  boolean row_qualified)
                           throws StandardException
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 interface LockingPolicy
Overrides:
unlockRecordAfterRead in class NoLocking
Throws:
StandardException - Standard exception policy.
See Also:
Page

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.