org.apache.ojb.odmg.locking
Class ReadUncommittedStrategy

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

public class ReadUncommittedStrategy
extends AbstractLockStrategy

The implementation of the Uncommited Reads Locking strategy. This strategy is the loosest of them all. It says you shouldn't need to get any Read locks whatsoever, but since it will probably try to get them, it will always give it to them. Locks are obtained on modifications to the database and held until end of transaction (EOT). Reading from the database does not involve any locking. Allows: Dirty Reads Non-Repeatable Reads Phantom Reads

Author:
Thomas Mahler & David Dixon-Peugh

Field Summary
 
Fields inherited from class org.apache.ojb.odmg.locking.AbstractLockStrategy
DEFAULT_LOCK_TIMEOUT
 
Constructor Summary
ReadUncommittedStrategy()
           
 
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

ReadUncommittedStrategy

public ReadUncommittedStrategy()
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 When we read Uncommitted, we don't care about Reader locks

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.