| java.lang.Object org.apache.commons.transaction.locking.GenericLockManager org.apache.commons.transaction.locking.ReadWriteLockManager
All known Subclasses: org.apache.commons.transaction.locking.ReadWriteUpgradeLockManager,
Method Summary | |
public boolean | checkReadLock(Object ownerId, Object resourceId) Determines if a shared, reentrant read lock on a resource
could be acquired without actually acquiring it. | public boolean | checkWriteLock(Object ownerId, Object resourceId) Determines if an exclusive, reentrant write lock on a resource
could be acquired without actually acquiring it. | protected GenericLock | createLock(Object resourceId) | public boolean | hasReadLock(Object ownerId, Object resourceId) Determines if a shared, reentrant read lock on a resource
is held by an owner. | public boolean | hasWriteLock(Object ownerId, Object resourceId) Determines if an exclusive, reentrant write lock on a resource
is held by an owner. | public void | readLock(Object ownerId, Object resourceId) Tries to acquire a shared, reentrant read lock on a resource. | public boolean | tryReadLock(Object ownerId, Object resourceId) Tries to acquire a shared, reentrant read lock on a resource. | public boolean | tryWriteLock(Object ownerId, Object resourceId) Tries to acquire an exclusive, reentrant write lock on a resource. | public void | writeLock(Object ownerId, Object resourceId) Tries to acquire an exclusive, reentrant write lock on a resource. |
ReadWriteLockManager | public ReadWriteLockManager(LoggerFacade logger, long timeoutMSecs)(Code) | | Creates a new read/write lock manager.
Parameters: logger - generic logger used for all kind of debug logging Parameters: timeoutMSecs - specifies the maximum time to wait for a lock in milliseconds |
checkReadLock | public boolean checkReadLock(Object ownerId, Object resourceId)(Code) | | Determines if a shared, reentrant read lock on a resource
could be acquired without actually acquiring it.
This method does not block, but immediatly returns. If a lock is not
available false will be returned.
Parameters: ownerId - a unique id identifying the entity that wants to acquire thislock Parameters: resourceId - the resource to get the lock for true if the lock could be acquired, false otherwise |
checkWriteLock | public boolean checkWriteLock(Object ownerId, Object resourceId)(Code) | | Determines if an exclusive, reentrant write lock on a resource
could be acquired without actually acquiring it.
This method does not block, but immediatly returns. If a lock is not
available false will be returned.
Parameters: ownerId - a unique id identifying the entity that wants to acquire thislock Parameters: resourceId - the resource to get the lock for true if the lock could be acquired, false otherwise |
hasReadLock | public boolean hasReadLock(Object ownerId, Object resourceId)(Code) | | Determines if a shared, reentrant read lock on a resource
is held by an owner.
Parameters: ownerId - a unique id identifying the entity that wants to check thislock Parameters: resourceId - the resource to get the lock for true if the lock is held by the owner, false otherwise |
hasWriteLock | public boolean hasWriteLock(Object ownerId, Object resourceId)(Code) | | Determines if an exclusive, reentrant write lock on a resource
is held by an owner.
Parameters: ownerId - a unique id identifying the entity that wants to check thislock Parameters: resourceId - the resource to get the lock for true if the lock is held by the owner, false otherwise |
readLock | public void readLock(Object ownerId, Object resourceId) throws LockException(Code) | | Tries to acquire a shared, reentrant read lock on a resource.
This method blocks and waits for the lock in case it is not avaiable. If
there is a timeout or a deadlock or the thread is interrupted a
LockException is thrown.
Parameters: ownerId - a unique id identifying the entity that wants to acquire thislock Parameters: resourceId - the resource to get the lock for throws: LockException - will be thrown when the lock can not be acquired |
tryReadLock | public boolean tryReadLock(Object ownerId, Object resourceId)(Code) | | Tries to acquire a shared, reentrant read lock on a resource.
This method does not block, but immediatly returns. If a lock is not
available false will be returned.
Parameters: ownerId - a unique id identifying the entity that wants to acquire thislock Parameters: resourceId - the resource to get the lock for true if the lock has been acquired, false otherwise |
tryWriteLock | public boolean tryWriteLock(Object ownerId, Object resourceId)(Code) | | Tries to acquire an exclusive, reentrant write lock on a resource.
This method does not block, but immediatly returns. If a lock is not
available false will be returned.
Parameters: ownerId - a unique id identifying the entity that wants to acquire thislock Parameters: resourceId - the resource to get the lock for true if the lock has been acquired, false otherwise |
writeLock | public void writeLock(Object ownerId, Object resourceId) throws LockException(Code) | | Tries to acquire an exclusive, reentrant write lock on a resource.
This method blocks and waits for the lock in case it is not avaiable. If
there is a timeout or a deadlock or the thread is interrupted a
LockException is thrown.
Parameters: ownerId - a unique id identifying the entity that wants to acquire thislock Parameters: resourceId - the resource to get the lock for throws: LockException - will be thrown when the lock can not be acquired |
Methods inherited from org.apache.commons.transaction.locking.GenericLockManager | protected void addOwner(Object ownerId, GenericLock lock)(Code)(Java Doc) public MultiLevelLock atomicGetOrCreateLock(Object resourceId)(Code)(Java Doc) public boolean checkLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)(Code)(Java Doc) protected GenericLock createLock(Object resourceId)(Code)(Java Doc) protected void doLock(GenericLock lock, Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs)(Code)(Java Doc) public Set getAll(Object ownerId)(Code)(Java Doc) public int getLevel(Object ownerId, Object resourceId)(Code)(Java Doc) public MultiLevelLock getLock(Object resourceId)(Code)(Java Doc) public Collection getLocks()(Code)(Java Doc) protected long getNextGlobalConflictTimeout(Set conflicts)(Code)(Java Doc) public boolean hasLock(Object ownerId, Object resourceId, int lockLevel)(Code)(Java Doc) public void lock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant) throws LockException(Code)(Java Doc) public void lock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant, long timeoutMSecs) throws LockException(Code)(Java Doc) public void lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs) throws LockException(Code)(Java Doc) public boolean release(Object ownerId, Object resourceId)(Code)(Java Doc) public void releaseAll(Object ownerId)(Code)(Java Doc) protected void releaseAllNoTimeOutReset(Object ownerId)(Code)(Java Doc) protected boolean releaseTimedOutOwners()(Code)(Java Doc) public void removeLock(MultiLevelLock lock)(Code)(Java Doc) protected void removeOwner(Object ownerId, GenericLock lock)(Code)(Java Doc) public void startGlobalTimeout(Object ownerId, long timeoutMSecs)(Code)(Java Doc) protected boolean timeOut(Object ownerId)(Code)(Java Doc) protected void timeoutCheck(Object ownerId) throws LockException(Code)(Java Doc) public synchronized String toString()(Code)(Java Doc) public boolean tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)(Code)(Java Doc) protected boolean wouldDeadlock(Object ownerId, Set path)(Code)(Java Doc)
|
|
|