| org.apache.ojb.broker.locking.CommonsOJBLockManager
Inner Class :abstract static class OJBLock extends GenericLock | |
Inner Class :static class ReadUncommittedLock extends RepeadableReadsLock | |
Inner Class :final static class ReadCommitedLock extends RepeadableReadsLock | |
Inner Class :static class RepeadableReadsLock extends OJBLock | |
Inner Class :final static class SerializeableLock extends ReadUncommittedLock | |
Constructor Summary | |
public | CommonsOJBLockManager(LoggerFacade logger, long timeoutMSecs, long checkThreshholdMSecs) |
Method Summary | |
public MultiLevelLock | atomicGetOrCreateLock(Object resourceId) | public OJBLock | atomicGetOrCreateLock(Object resourceId, Object isolationId) Either gets an existing lock on the specified resource or creates one if none exists.
This methods guarantees to do this atomically.
Parameters: resourceId - the resource to get or create the lock on Parameters: isolationId - the isolation level identity key. | public OJBLock | createIsolationLevel(Object resourceId, Object isolationId, LoggerFacade logger) Creates
org.apache.commons.transaction.locking.GenericLock based
org.apache.commons.transaction.locking.MultiLevelLock2 instances
dependend on the specified isolation identity object. | protected GenericLock | createLock(Object resourceId) | protected GenericLock | createLock(Object resourceId, Object isolationId) | public void | lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs) | public void | lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs, Object isolationId) Most flexible way to acquire a lock on a resource. | int | mapLockLevelDependendOnIsolationLevel(Integer isolationId, int lockLevel) Helper method to map the specified common lock level (e.g like
CommonsOJBLockManager.COMMON_READ_LOCK ,
#COMMON_UPGRADE_LOCK, ... | public boolean | tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant) | public boolean | tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant, Object isolationId) Tries to acquire a lock on a resource. |
COMMON_READ_LOCK | final static int COMMON_READ_LOCK(Code) | | |
COMMON_UPGRADE_LOCK | final static int COMMON_UPGRADE_LOCK(Code) | | |
COMMON_WRITE_LOCK | final static int COMMON_WRITE_LOCK(Code) | | |
CommonsOJBLockManager | public CommonsOJBLockManager(LoggerFacade logger, long timeoutMSecs, long checkThreshholdMSecs) throws IllegalArgumentException(Code) | | |
atomicGetOrCreateLock | public MultiLevelLock atomicGetOrCreateLock(Object resourceId)(Code) | | See Also: org.apache.commons.transaction.locking.GenericLockManager.atomicGetOrCreateLock(Object) |
atomicGetOrCreateLock | public OJBLock atomicGetOrCreateLock(Object resourceId, Object isolationId)(Code) | | Either gets an existing lock on the specified resource or creates one if none exists.
This methods guarantees to do this atomically.
Parameters: resourceId - the resource to get or create the lock on Parameters: isolationId - the isolation level identity key. See CommonsOJBLockManager. the lock for the specified resource |
createIsolationLevel | public OJBLock createIsolationLevel(Object resourceId, Object isolationId, LoggerFacade logger)(Code) | | Creates
org.apache.commons.transaction.locking.GenericLock based
org.apache.commons.transaction.locking.MultiLevelLock2 instances
dependend on the specified isolation identity object.
|
createLock | protected GenericLock createLock(Object resourceId)(Code) | | See Also: org.apache.commons.transaction.locking.GenericLockManager.createLock(Object) |
lock | public void lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs) throws LockException(Code) | | See Also: org.apache.commons.transaction.locking.GenericLockManager.lock(ObjectObjectintintbooleanlong) |
lock | public void lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs, Object isolationId) throws LockException(Code) | | Most flexible way to acquire a 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 level for Parameters: targetLockLevel - the lock level to acquire Parameters: compatibility - GenericLock.COMPATIBILITY_NONEif no additional compatibility isdesired (same as reentrant set to false) ,GenericLock.COMPATIBILITY_REENTRANTif lock level by the sameowner shall not affect compatibility (same as reentrant set totrue), or GenericLock.COMPATIBILITY_SUPPORTif lock levels thatare the same as the desired shall not affect compatibility, orfinally GenericLock.COMPATIBILITY_REENTRANT_AND_SUPPORTwhich isa combination of reentrant and support Parameters: preferred - in case this lock request is incompatible with existing onesand we wait, it shall be granted before other waiting requeststhat are not preferred Parameters: timeoutMSecs - specifies the maximum wait time in milliseconds Parameters: isolationId - the isolation level identity key. See CommonsOJBLockManager. throws: LockException - will be thrown when the lock can not be acquired |
mapLockLevelDependendOnIsolationLevel | int mapLockLevelDependendOnIsolationLevel(Integer isolationId, int lockLevel)(Code) | | Helper method to map the specified common lock level (e.g like
CommonsOJBLockManager.COMMON_READ_LOCK ,
#COMMON_UPGRADE_LOCK, ... ) based
on the isolation level to the internal used lock level value by the
org.apache.commons.transaction.locking.MultiLevelLock2 implementation.
Parameters: isolationId - Parameters: lockLevel - |
tryLock | public boolean tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)(Code) | | See Also: org.apache.commons.transaction.locking.GenericLockManager.tryLock(ObjectObjectintboolean) |
tryLock | public boolean tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant, Object isolationId)(Code) | | Tries to acquire a 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 level for Parameters: targetLockLevel - the lock level to acquire Parameters: reentrant - true if this request shall not be influenced byother locks held by the same owner Parameters: isolationId - the isolation level identity key. See CommonsOJBLockManager. true if the lock has been acquired, false otherwise |
|
|