org.apache.ojb.odmg.locking
Class ReadUncommittedStrategy

java.lang.Object
  extended byorg.apache.ojb.odmg.locking.AbstractLockStrategy
      extended byorg.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, java.lang.Object obj)
          checks whether the specified Object obj is read-locked by Transaction tx.
 boolean checkWrite(TransactionImpl tx, java.lang.Object obj)
          checks whether the specified Object obj is write-locked by Transaction tx.
 boolean readLock(TransactionImpl tx, java.lang.Object obj)
          acquire a read lock on Object obj for Transaction tx.
 boolean releaseLock(TransactionImpl tx, java.lang.Object obj)
          release a lock on Object obj for Transaction tx.
 boolean upgradeLock(TransactionImpl tx, java.lang.Object obj)
          acquire a lock upgrade (from read to write) lock on Object obj for Transaction tx.
 boolean writeLock(TransactionImpl tx, java.lang.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,
                        java.lang.Object obj)
acquire a read lock on Object obj for Transaction tx. * @param tx the transaction requesting the lock * @param obj the Object to be locked * @return true if successful, else false * When we read Uncommitted, we don't care about Reader locks


writeLock

public boolean writeLock(TransactionImpl tx,
                         java.lang.Object obj)
acquire a write lock on Object obj for Transaction tx. * @param tx the transaction requesting the lock * @param obj the Object to be locked * @return true if successful, else false *


upgradeLock

public boolean upgradeLock(TransactionImpl tx,
                           java.lang.Object obj)
acquire a lock upgrade (from read to write) lock on Object obj for Transaction tx. * @param tx the transaction requesting the lock * @param obj the Object to be locked * @return true if successful, else false *


releaseLock

public boolean releaseLock(TransactionImpl tx,
                           java.lang.Object obj)
release a lock on Object obj for Transaction tx. * @param tx the transaction releasing the lock * @param obj the Object to be unlocked * @return true if successful, else false *


checkRead

public boolean checkRead(TransactionImpl tx,
                         java.lang.Object obj)
checks whether the specified Object obj is read-locked by Transaction tx. * @param tx the transaction * @param obj the Object to be checked * @return true if lock exists, else false


checkWrite

public boolean checkWrite(TransactionImpl tx,
                          java.lang.Object obj)
checks whether the specified Object obj is write-locked by Transaction tx. * @param tx the transaction * @param obj the Object to be checked * @return true if lock exists, else false



Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14