ojb.server.lockstrategy
Class RWSerializableStrategy

java.lang.Object
  |
  +--ojb.server.lockstrategy.RWSerializableStrategy
All Implemented Interfaces:
ReaderWriterLock

public class RWSerializableStrategy
extends java.lang.Object
implements ReaderWriterLock

Class declaration

Version:
%I%, %G%
Author:
 

Fields inherited from interface ojb.server.lockstrategy.ReaderWriterLock
RW_READ_COMMITTED, RW_READ_UNCOMMITTED, RW_REPEATABLE_READ, RW_SERIALIZABLE
 
Constructor Summary
RWSerializableStrategy()
          Constructor declaration
 
Method Summary
 boolean checkRead(Transaction tx)
          checkRead -- Identify if Read access is granted.
 boolean checkWrite(Transaction tx)
          checkWrite -- Determine if Write access is granted.
 java.lang.String getLockType(Transaction t)
          getLockType - Returns an "R" if it is a Read lock, "W" if it is a Write lock, or "0" (zero) if it isn't locked.
 int getStrategy()
          getStrategy -- Return ReaderWriterLock.RW_SERIALIZABLE
 boolean read(Transaction r)
          read -- Acquire a Read lock for the given Transaction.
 boolean release(Transaction t)
          release -- Release the hold on the object.
 boolean upgrade(Transaction u)
          upgrade -- Try to upgrade the lock to Write.
 boolean write(Transaction w)
          write -- Acquire a Write lock for the given transaction.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RWSerializableStrategy

public RWSerializableStrategy()
Constructor declaration
See Also:
Method Detail

read

public boolean read(Transaction r)
read -- Acquire a Read lock for the given Transaction.
Specified by:
read in interface ReaderWriterLock
Parameters:
r - - Transaction acquiring the lock.
Returns:
Whether lock was granted or not.

write

public boolean write(Transaction w)
write -- Acquire a Write lock for the given transaction.
Specified by:
write in interface ReaderWriterLock
Parameters:
w - - Transaction acquiring the lock.
Returns:
wether the lock was granted or not.

upgrade

public boolean upgrade(Transaction u)
upgrade -- Try to upgrade the lock to Write.
Specified by:
upgrade in interface ReaderWriterLock
Parameters:
u - - Transaction trying to upgrade.
Returns:
Whether the upgrade was successful.

release

public boolean release(Transaction t)
release -- Release the hold on the object.
Specified by:
release in interface ReaderWriterLock
Parameters:
t - Transaction to release lock.

getLockType

public java.lang.String getLockType(Transaction t)
getLockType - Returns an "R" if it is a Read lock, "W" if it is a Write lock, or "0" (zero) if it isn't locked.
Specified by:
getLockType in interface ReaderWriterLock
Following copied from interface: ojb.server.lockstrategy.ReaderWriterLock
Parameters:
tx -  
Returns:
 
See Also:

getStrategy

public int getStrategy()
getStrategy -- Return ReaderWriterLock.RW_SERIALIZABLE
Specified by:
getStrategy in interface ReaderWriterLock
Following copied from interface: ojb.server.lockstrategy.ReaderWriterLock
Returns:
 
See Also:

checkRead

public boolean checkRead(Transaction tx)
checkRead -- Identify if Read access is granted.
Specified by:
checkRead in interface ReaderWriterLock
Following copied from interface: ojb.server.lockstrategy.ReaderWriterLock
Parameters:
tx -  
Returns:
 
See Also:

checkWrite

public boolean checkWrite(Transaction tx)
checkWrite -- Determine if Write access is granted.
Specified by:
checkWrite in interface ReaderWriterLock
Following copied from interface: ojb.server.lockstrategy.ReaderWriterLock
Parameters:
tx -  
Returns:
 
See Also:


Authors: Thomas Mahler, David Dixon-Peugh. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.1.120, 2001-05-12