| java.lang.Object com.rift.coad.util.lock.ObjectLockFactory
ObjectLockFactory | public class ObjectLockFactory (Code) | | The object lock factory is responsible for assigning locks based on the
object passed in. Object locks are designed to work in conjunction with
transaction locks. They are designed to cater for named locks that are not
thread id dependant. This means it is possible to lock an object until a
transaction is complete, even though the transaction is being controlled
from another and hense different threads.
There are four different types of object locks; read lock, read named lock,
write lock and a named write lock.
All locks are re-entrant. Meaning they can be locked a number of times and
must be unlocked the same number of times. If a read lock needs to change to
a write lock, that lock must be released before this can be done otherwise a
dead lock will occur.
A write lock can change from a write thread id lock to a write thread named
lock. A read lock cannot change from a thread id lock to a named id lock.
author: Brett Chaldecott |
Inner Class :public class Lock | |
Inner Class :public class ObjectLockRef implements LockRef | |
DO_NOT_WAIT | final public static int DO_NOT_WAIT(Code) | | |
WAIT | final public static int WAIT(Code) | | |
WAIT_ON_NAMED | final public static int WAIT_ON_NAMED(Code) | | |
WAIT_ON_THREAD | final public static int WAIT_ON_THREAD(Code) | | |
log | protected static Logger log(Code) | | |
acquireReadLock | public LockRef acquireReadLock(Object key) throws LockException(Code) | | This method creates a new lock for the specified key.
The object lock reference. Parameters: key - The key to lock this object with. exception: LockException - |
acquireReadLock | public LockRef acquireReadLock(Object key, Object name) throws LockException(Code) | | This method creates a new read lock for the specified key.
The object lock reference. Parameters: key - The key to lock this object with. Parameters: name - The name ofthe lock. exception: LockException - |
acquireWriteLock | public LockRef acquireWriteLock(Object key) throws LockException(Code) | | This method creates a new lock for the specified key.
A reference to the lock object. Parameters: key - The key that identifies the unique lock. exception: LockException - |
acquireWriteLock | public LockRef acquireWriteLock(Object key, int waitFlags) throws LockException, LockConflict(Code) | | This method creates a new lock for the specified key. It will wait
depending on the specified flag.
The object lock reference. Parameters: key - The key to lock this object with. Parameters: waitFlags - The flags to wait on. exception: LockException - exception: LockConflict - |
acquireWriteLock | public LockRef acquireWriteLock(Object key, Object name) throws LockException(Code) | | This method creates a new lock for the specified key.
The reference to the lock object. Parameters: key - The key that the lock will be aquired for. Parameters: name - The name of the lock. exception: LockException - |
acquireWriteLock | public LockRef acquireWriteLock(Object key, Object name, int waitFlags) throws LockException, LockConflict(Code) | | This method creates a new lock for the specified key. It will wait
depending on the specified flag.
The object lock reference. Parameters: key - The key to lock this object with. Parameters: name - The name ofthe lock. Parameters: waitFlags - The flags to wait on. exception: LockException - exception: LockConflict - |
fin | public static synchronized void fin() throws LockException(Code) | | This method removes the object lock factory associated with a class
loader.
exception: LockException - |
getInstance | public static synchronized ObjectLockFactory getInstance() throws LockException(Code) | | This method returns the object lock factory singleton reference.
The object lock factory singleton reference. LockException. |
init | public static synchronized void init() throws LockException(Code) | | This method creates a new object lock factory singleton for a class
loader.
exception: LockException - |
releaseLock | public void releaseLock(Object key) throws LockException(Code) | | This method releases the lock held on a given object.
Parameters: key - The key identifying the lock. exception: LockException - |
|
|