| java.lang.Object org.apache.ojb.odmg.locking.LockManagerDefaultImpl
LockManagerDefaultImpl | public class LockManagerDefaultImpl implements LockManager(Code) | | The OJB default implementation of a Locking mechanism.
This Implementation supports 4 transaction isolation levels
as specified in the interface
org.apache.ojb.broker.locking.IsolationLevels :
public final int IL_READ_UNCOMMITTED = 0;
public final int IL_READ_COMMITTED = 1;
public final int IL_REPEATABLE_READ = 2;
public final int IL_SERIALIZABLE = 3;
Isolationlevels can be adjusted per class.
The proper lockhandling is done in the respective LockStrategy implementation.
This default implementation provides persistent Locks that are stored in
a special database table.
To keep the locks in the database and not in memory allows to use
them accross multiple distributed ODMG clients.
Of course this solution causes a lot of database reads and writes even if
no real application data is written to the database. This solution may
thus not be suited for all environments. As the LockManager is pluggable
its possible to replace the default implementation by user defined
implementations.
A different solution might be to implement the LockManager as an additional
standalone server, that allows to elminate additional db reads and writes.
author: thma |
Method Summary | |
public synchronized boolean | checkRead(TransactionImpl tx, Object obj) checks if there is a readlock for transaction tx on object obj. | public boolean | checkRead(TransactionImpl tx, Identity oid, Object obj) | public synchronized boolean | checkWrite(TransactionImpl tx, Object obj) checks if there is a writelock for transaction tx on object obj. | public boolean | checkWrite(TransactionImpl tx, Identity oid, Object obj) | public synchronized boolean | readLock(TransactionImpl tx, Object obj) aquires a readlock for transaction tx on object obj. | public boolean | readLock(TransactionImpl tx, Identity oid, Object obj) | public synchronized boolean | releaseLock(TransactionImpl tx, Object obj) releases a lock for transaction tx on object obj. | public boolean | releaseLock(TransactionImpl tx, Identity oid, Object obj) | public synchronized boolean | upgradeLock(TransactionImpl tx, Object obj) upgrades readlock for transaction tx on object obj to a writelock. | public boolean | upgradeLock(TransactionImpl tx, Identity oid, Object obj) | public synchronized boolean | writeLock(TransactionImpl tx, Object obj) aquires a writelock for transaction tx on object obj. | public boolean | writeLock(TransactionImpl tx, Identity oid, Object obj) |
LockManagerDefaultImpl | public LockManagerDefaultImpl()(Code) | | |
checkRead | public synchronized boolean checkRead(TransactionImpl tx, Object obj)(Code) | | checks if there is a readlock for transaction tx on object obj.
Returns true if so, else false.
|
checkWrite | public synchronized boolean checkWrite(TransactionImpl tx, Object obj)(Code) | | checks if there is a writelock for transaction tx on object obj.
Returns true if so, else false.
|
readLock | public synchronized boolean readLock(TransactionImpl tx, Object obj)(Code) | | aquires a readlock for transaction tx on object obj.
Returns true if successful, else false.
|
releaseLock | public synchronized boolean releaseLock(TransactionImpl tx, Object obj)(Code) | | releases a lock for transaction tx on object obj.
Returns true if successful, else false.
|
upgradeLock | public synchronized boolean upgradeLock(TransactionImpl tx, Object obj)(Code) | | 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.
|
writeLock | public synchronized boolean writeLock(TransactionImpl tx, Object obj)(Code) | | aquires a writelock for transaction tx on object obj.
Returns true if successful, else false.
|
|
|