org.apache.ojb.odmg.locking
Interface LockManager

All Known Implementing Classes:
LockManagerDefaultImpl

public interface LockManager

This interface declares the functionality of the OJB internal Locking mechanism. * A default implementaion LockManagerDefaultImpl is provided. This implementaion * keeps distributed locks in the database. The locking mechanisms thus involves a * lot of database lookups and writes. For some environments this solution may not * be adequate. OJB allows to provide user defined implementations of this interface. * To activate a user defined LockManagerDefaultImpl it must be configured in the OJB.properties file. * * * @author thma


Method Summary
 boolean checkRead(TransactionImpl tx, java.lang.Object obj)
          checks if there is a readlock for transaction tx on object obj.
 boolean checkWrite(TransactionImpl tx, java.lang.Object obj)
          checks if there is a writelock for transaction tx on object obj.
 boolean readLock(TransactionImpl tx, java.lang.Object obj)
          aquires a readlock for transaction tx on object obj.
 boolean releaseLock(TransactionImpl tx, java.lang.Object obj)
          releases a lock for transaction tx on object obj.
 boolean upgradeLock(TransactionImpl tx, java.lang.Object obj)
          upgrades readlock for transaction tx on object obj to a writelock.
 boolean writeLock(TransactionImpl tx, java.lang.Object obj)
          aquires a writelock for transaction tx on object obj.
 

Method Detail

readLock

public boolean readLock(TransactionImpl tx,
                        java.lang.Object obj)
aquires a readlock for transaction tx on object obj. * Returns true if successful, else false.


writeLock

public boolean writeLock(TransactionImpl tx,
                         java.lang.Object obj)
aquires a writelock for transaction tx on object obj. * Returns true if successful, else false.


upgradeLock

public boolean upgradeLock(TransactionImpl tx,
                           java.lang.Object obj)
upgrades readlock for transaction tx on object obj to a writelock. * If no readlock existed a writelock is acquired anyway. * Returns true if successful, else false.


releaseLock

public boolean releaseLock(TransactionImpl tx,
                           java.lang.Object obj)
releases a lock for transaction tx on object obj. * Returns true if successful, else false.


checkRead

public boolean checkRead(TransactionImpl tx,
                         java.lang.Object obj)
checks if there is a readlock for transaction tx on object obj. * Returns true if so, else false.


checkWrite

public boolean checkWrite(TransactionImpl tx,
                          java.lang.Object obj)
checks if there is a writelock for transaction tx on object obj. * Returns true if so, 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