org.apache.ojb.odmg.locking
Class ReadCommittedStrategy

java.lang.Object
  extended by org.apache.ojb.odmg.locking.AbstractLockStrategy
      extended by org.apache.ojb.odmg.locking.ReadCommittedStrategy
All Implemented Interfaces:
LockStrategy

public class ReadCommittedStrategy
extends AbstractLockStrategy

The implementation of the Commited Reads Locking stra ReadCommitted - Reads and Writes require locks. Locks are acquired for reading and modifying the database. Locks are released after reading but locks on modified objects are held until EOT. Allows: Non-Repeatable Reads Phantom Readstegy.

Author:
Thomas Mahler & David Dixon-Peugh

Field Summary
 
Fields inherited from class org.apache.ojb.odmg.locking.AbstractLockStrategy
DEFAULT_LOCK_TIMEOUT
 
Constructor Summary
ReadCommittedStrategy()
           
 
Method Summary
 boolean checkRead(TransactionImpl tx, Object obj)
          checks whether the specified Object obj is read-locked by Transaction tx.
 boolean checkWrite(TransactionImpl tx, Object obj)
          checks whether the specified Object obj is write-locked by Transaction tx.
 boolean readLock(TransactionImpl tx, Object obj)
          acquire a read lock on Object obj for Transaction tx.
 boolean releaseLock(TransactionImpl tx, Object obj)
          release a lock on Object obj for Transaction tx.
 boolean upgradeLock(TransactionImpl tx, Object obj)
          acquire a lock upgrade (from read to write) lock on Object obj for Transaction tx.
 boolean writeLock(TransactionImpl tx, Object obj)
          acquire a write lock on Object obj for Transaction tx.
 
Methods inherited from class org.apache.ojb.odmg.locking.AbstractLockStrategy
addReader, getReaders, getWriter, hasReadLock, removeReader, removeWriter, setWriter, upgradeLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadCommittedStrategy

public ReadCommittedStrategy()
Method Detail

readLock

public boolean readLock(TransactionImpl tx,
                        Object obj)
acquire a read lock on Object obj for Transaction tx.

Parameters:
tx - the transaction requesting the lock
obj - the Object to be locked
Returns:
true if successful, else false

writeLock

public boolean writeLock(TransactionImpl tx,
                         Object obj)
acquire a write lock on Object obj for Transaction tx.

Parameters:
tx - the transaction requesting the lock
obj - the Object to be locked
Returns:
true if successful, else false

upgradeLock

public boolean upgradeLock(TransactionImpl tx,
                           Object obj)
acquire a lock upgrade (from read to write) lock on Object obj for Transaction tx.

Parameters:
tx - the transaction requesting the lock
obj - the Object to be locked
Returns:
true if successful, else false

releaseLock

public boolean releaseLock(TransactionImpl tx,
                           Object obj)
release a lock on Object obj for Transaction tx.

Parameters:
tx - the transaction releasing the lock
obj - the Object to be unlocked
Returns:
true if successful, else false

checkRead

public boolean checkRead(TransactionImpl tx,
                         Object obj)
checks whether the specified Object obj is read-locked by Transaction tx.

Parameters:
tx - the transaction
obj - the Object to be checked
Returns:
true if lock exists, else false

checkWrite

public boolean checkWrite(TransactionImpl tx,
                          Object obj)
checks whether the specified Object obj is write-locked by Transaction tx.

Parameters:
tx - the transaction
obj - the Object to be checked
Returns:
true if lock exists, else false


Copyright © 2007-2012 The Kuali Foundation. All Rights Reserved.