ojb.odmg.locking
Class AbstractLockStrategy

java.lang.Object
  |
  +--ojb.odmg.locking.AbstractLockStrategy
All Implemented Interfaces:
LockStrategy
Direct Known Subclasses:
ReadCommittedStrategy, ReadUncommittedStrategy, RepeatableReadStrategy, SerializableStrategy

public abstract class AbstractLockStrategy
extends java.lang.Object
implements LockStrategy

The base class of all LockingStrategies. It provides the basic infrastructure to read and write locks to the persistent storage.

Author:
Thomas Mahler

Field Summary
static long DEFAULT_LOCK_TIMEOUT
          the timeout for lock entries
 
Constructor Summary
AbstractLockStrategy()
           
 
Method Summary
protected  boolean addReader(TransactionImpl tx, java.lang.Object obj)
          Add a reader lock entry for transaction tx on object obj to the persistent storage.
protected  java.util.Collection getReaders(java.lang.Object obj)
          returns a collection of Reader LockEntries for object obj.
protected  LockEntry getWriter(java.lang.Object obj)
          returns the LockEntry for the Writer of object obj.
protected  boolean hasReadLock(TransactionImpl tx, java.lang.Object obj)
          check if there is a reader lock entry for transaction tx on object obj in the persistent storage.
protected  void removeReader(TransactionImpl tx, java.lang.Object obj)
          remove a reader lock entry for transaction tx on object obj from the persistent storage.
protected  void removeWriter(LockEntry writer)
          remove a writer lock entry for transaction tx on object obj from the persistent storage.
protected  boolean setWriter(TransactionImpl tx, java.lang.Object obj)
          generate a writer lock entry for transaction tx on object obj and write it to the persistent storage.
protected  boolean upgradeLock(LockEntry reader)
          upgrade a reader lock entry for transaction tx on object obj and write it to the persistent storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ojb.odmg.locking.LockStrategy
checkRead, checkWrite, readLock, releaseLock, upgradeLock, writeLock
 

Field Detail

DEFAULT_LOCK_TIMEOUT

public static long DEFAULT_LOCK_TIMEOUT
the timeout for lock entries

Constructor Detail

AbstractLockStrategy

public AbstractLockStrategy()
Method Detail

getWriter

protected LockEntry getWriter(java.lang.Object obj)
returns the LockEntry for the Writer of object obj. If now writer exists, null is returned.


getReaders

protected java.util.Collection getReaders(java.lang.Object obj)
returns a collection of Reader LockEntries for object obj. If now LockEntries could be found an empty Vector is returned.


addReader

protected boolean addReader(TransactionImpl tx,
                            java.lang.Object obj)
Add a reader lock entry for transaction tx on object obj to the persistent storage.


removeReader

protected void removeReader(TransactionImpl tx,
                            java.lang.Object obj)
remove a reader lock entry for transaction tx on object obj from the persistent storage.


removeWriter

protected void removeWriter(LockEntry writer)
remove a writer lock entry for transaction tx on object obj from the persistent storage.


upgradeLock

protected boolean upgradeLock(LockEntry reader)
upgrade a reader lock entry for transaction tx on object obj and write it to the persistent storage.


setWriter

protected boolean setWriter(TransactionImpl tx,
                            java.lang.Object obj)
generate a writer lock entry for transaction tx on object obj and write it to the persistent storage.


hasReadLock

protected boolean hasReadLock(TransactionImpl tx,
                              java.lang.Object obj)
check if there is a reader lock entry for transaction tx on object obj in the persistent storage.



Authors: Thomas Mahler and others. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.8.375, 2002-04-04