ojb.odmg.locking
Interface LockStrategy

All Known Implementing Classes:
AbstractLockStrategy

public interface LockStrategy

this interface defines method that a Locking Strategy must implement according to the transaction isolation level it represents. *


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.
 

Method Detail

readLock

public boolean readLock(TransactionImpl tx,
                        java.lang.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,
                         java.lang.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,
                           java.lang.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,
                           java.lang.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,
                         java.lang.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,
                          java.lang.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


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