| org.apache.ojb.broker.locking.LockManager
All known Subclasses: org.apache.ojb.broker.locking.LockManagerInMemoryImpl, org.apache.ojb.broker.locking.LockManagerRemoteImpl, org.apache.ojb.broker.locking.LockManagerCommonsImpl,
LockManager | public interface LockManager extends IsolationLevels(Code) | | This interface declares the functionality of the OJB locking-api for support of
pessimistic locking.
OJB allows to provide user defined implementations of this interface.
To activate a user defined LockManager implementation it must be configured in
the OJB.properties file.
All locks have to be reentrant, this means if you already have a lock for
writing and you try to acquire write access again you will not be blocked
by this first lock.
It's optional to support the lockTimeout and blockTimeout properties.
See Also: LockManagerInMemoryImpl See Also: LockManagerCommonsImpl version: $Id: LockManager.java,v 1.1.2.5 2005/12/21 22:25:32 tomdz Exp $ |
Method Summary | |
public long | getBlockTimeout() The maximal time to wait for acquire a lock. | public String | getLockInfo() Returns info about the used lock manager implementation and the state
of the lock manager. | public long | getLockTimeout() Get the current used lock timeout value in milliseconds. | public boolean | hasRead(Object key, Object resourceId) Checks if there is a read lock for owner key on resource object.
Returns true if so, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to check. | public boolean | hasUpgrade(Object key, Object resourceId) Checks if there is a upgrade lock for lock key on resource object.
Returns true if so, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to check. | public boolean | hasWrite(Object key, Object resourceId) Checks if there is a write lock for lock key on resource object.
Returns true if so, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to check. | public boolean | readLock(Object key, Object resourceId, int isolationLevel) Acquires a readlock for lock key on resource object.
Returns true if successful, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to lock. Parameters: isolationLevel - The isolation level of the lock. | public boolean | releaseLock(Object key, Object resourceId) Releases a lock for lock key on resource object.
Returns true if successful, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to release. | public void | releaseLocks(Object key) Release all resource locks hold by the specified owner key. | public void | setBlockTimeout(long timeout) Set the maximal time to wait for acquire a lock in milliseconds. | public void | setLockTimeout(long timeout) Set the lock timeout value in milliseconds. | public boolean | upgradeLock(Object key, Object resourceId, int isolationLevel) Acquire an upgrade lock.
(Current implementations always acquire a write lock instead).
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to lock. Parameters: isolationLevel - The isolation level of the lock. | public boolean | writeLock(Object key, Object resourceId, int isolationLevel) Acquires a write lock for lock key on resource object.
Returns true if successful, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to lock. Parameters: isolationLevel - The isolation level of the lock. |
DEFAULT_BLOCK_TIMEOUT | final public static long DEFAULT_BLOCK_TIMEOUT(Code) | | Default lock wait time in millisecond - set to 1000 ms;
|
DEFAULT_LOCK_TIMEOUT | final public static long DEFAULT_LOCK_TIMEOUT(Code) | | Default lock timeout value - set to 60000 ms.
|
getBlockTimeout | public long getBlockTimeout()(Code) | | The maximal time to wait for acquire a lock.
|
getLockInfo | public String getLockInfo()(Code) | | Returns info about the used lock manager implementation and the state
of the lock manager.
|
getLockTimeout | public long getLockTimeout()(Code) | | Get the current used lock timeout value in milliseconds.
Current used locking timeout value in ms. |
hasRead | public boolean hasRead(Object key, Object resourceId)(Code) | | Checks if there is a read lock for owner key on resource object.
Returns true if so, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to check. True if the lock exists. |
hasUpgrade | public boolean hasUpgrade(Object key, Object resourceId)(Code) | | Checks if there is a upgrade lock for lock key on resource object.
Returns true if so, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to check. True if the lock exists. |
hasWrite | public boolean hasWrite(Object key, Object resourceId)(Code) | | Checks if there is a write lock for lock key on resource object.
Returns true if so, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to check. True if the lock exists. |
readLock | public boolean readLock(Object key, Object resourceId, int isolationLevel)(Code) | | Acquires a readlock for lock key on resource object.
Returns true if successful, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to lock. Parameters: isolationLevel - The isolation level of the lock. True if the lock was successfully acquired. |
releaseLock | public boolean releaseLock(Object key, Object resourceId)(Code) | | Releases a lock for lock key on resource object.
Returns true if successful, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to release. True if the lock was successfully released. |
releaseLocks | public void releaseLocks(Object key)(Code) | | Release all resource locks hold by the specified owner key.
Parameters: key - The owner key to release all associated locks. |
setBlockTimeout | public void setBlockTimeout(long timeout)(Code) | | Set the maximal time to wait for acquire a lock in milliseconds.
All so called non-blocking implementation will ignore this setting.
Parameters: timeout - The time to wait for acquire a lock. |
setLockTimeout | public void setLockTimeout(long timeout)(Code) | | Set the lock timeout value in milliseconds. If timeout was set to -1
the never will never timeout.
Parameters: timeout - The lock timeout in ms of acquired read/write/upgrade locks. |
upgradeLock | public boolean upgradeLock(Object key, Object resourceId, int isolationLevel)(Code) | | Acquire an upgrade lock.
(Current implementations always acquire a write lock instead).
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to lock. Parameters: isolationLevel - The isolation level of the lock. True if the lock was successfully acquired. |
writeLock | public boolean writeLock(Object key, Object resourceId, int isolationLevel)(Code) | | Acquires a write lock for lock key on resource object.
Returns true if successful, else false.
Parameters: key - The owner key of the lock. Parameters: resourceId - The resource to lock. Parameters: isolationLevel - The isolation level of the lock. True if the lock was successfully acquired. |
|
|