|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGenericLockManager
org.apache.ojb.broker.locking.CommonsOJBLockManager
Extension of org.apache.commons.transaction.locking.GenericLockManager
to
support all locking isolation level defined in OJB locking api and a provider of
specific org.apache.commons.transaction.locking.GenericLock
implementation classes
representing the isolation levels specified in LockManager
, like
IsolationLevels.IL_READ_COMMITTED
, ... .
#createIsolationLevel(Object, Object, org.apache.commons.transaction.util.LoggerFacade)
dependend on the specified isolation level.
Constructor Summary | |
CommonsOJBLockManager(LoggerFacade logger,
long timeoutMSecs,
long checkThreshholdMSecs)
|
Method Summary | |
MultiLevelLock |
atomicGetOrCreateLock(java.lang.Object resourceId)
|
org.apache.ojb.broker.locking.CommonsOJBLockManager.OJBLock |
atomicGetOrCreateLock(java.lang.Object resourceId,
java.lang.Object isolationId)
Either gets an existing lock on the specified resource or creates one if none exists. |
org.apache.ojb.broker.locking.CommonsOJBLockManager.OJBLock |
createIsolationLevel(java.lang.Object resourceId,
java.lang.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. |
void |
lock(java.lang.Object ownerId,
java.lang.Object resourceId,
int targetLockLevel,
int compatibility,
boolean preferred,
long timeoutMSecs)
|
void |
lock(java.lang.Object ownerId,
java.lang.Object resourceId,
int targetLockLevel,
int compatibility,
boolean preferred,
long timeoutMSecs,
java.lang.Object isolationId)
Most flexible way to acquire a lock on a resource. |
boolean |
tryLock(java.lang.Object ownerId,
java.lang.Object resourceId,
int targetLockLevel,
boolean reentrant)
|
boolean |
tryLock(java.lang.Object ownerId,
java.lang.Object resourceId,
int targetLockLevel,
boolean reentrant,
java.lang.Object isolationId)
Tries to acquire a lock on a resource. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CommonsOJBLockManager(LoggerFacade logger, long timeoutMSecs, long checkThreshholdMSecs) throws java.lang.IllegalArgumentException
Method Detail |
public boolean tryLock(java.lang.Object ownerId, java.lang.Object resourceId, int targetLockLevel, boolean reentrant)
org.apache.commons.transaction.locking.GenericLockManager#tryLock(Object, Object, int, boolean)
public boolean tryLock(java.lang.Object ownerId, java.lang.Object resourceId, int targetLockLevel, boolean reentrant, java.lang.Object isolationId)
false
will be returned.
ownerId
- a unique id identifying the entity that wants to acquire this
lockresourceId
- the resource to get the level fortargetLockLevel
- the lock level to acquirereentrant
- true
if this request shall not be influenced by
other locks held by the same ownerisolationId
- the isolation level identity key. See CommonsOJBLockManager
.
true
if the lock has been acquired, false
otherwisepublic void lock(java.lang.Object ownerId, java.lang.Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs) throws LockException
LockException
org.apache.commons.transaction.locking.GenericLockManager#lock(Object, Object, int, int, boolean, long)
public void lock(java.lang.Object ownerId, java.lang.Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs, java.lang.Object isolationId) throws LockException
ownerId
- a unique id identifying the entity that wants to acquire this
lockresourceId
- the resource to get the level fortargetLockLevel
- the lock level to acquirecompatibility
- GenericLock#COMPATIBILITY_NONE
if no additional compatibility is
desired (same as reentrant set to false) ,
GenericLock#COMPATIBILITY_REENTRANT
if lock level by the same
owner shall not affect compatibility (same as reentrant set to
true), or GenericLock#COMPATIBILITY_SUPPORT
if lock levels that
are the same as the desired shall not affect compatibility, or
finally GenericLock#COMPATIBILITY_REENTRANT_AND_SUPPORT
which is
a combination of reentrant and supportpreferred
- in case this lock request is incompatible with existing ones
and we wait, it shall be granted before other waiting requests
that are not preferredtimeoutMSecs
- specifies the maximum wait time in millisecondsisolationId
- the isolation level identity key. See CommonsOJBLockManager
.
LockException
- will be thrown when the lock can not be acquiredpublic MultiLevelLock atomicGetOrCreateLock(java.lang.Object resourceId)
org.apache.commons.transaction.locking.GenericLockManager#atomicGetOrCreateLock(Object)
public org.apache.ojb.broker.locking.CommonsOJBLockManager.OJBLock atomicGetOrCreateLock(java.lang.Object resourceId, java.lang.Object isolationId)
resourceId
- the resource to get or create the lock onisolationId
- the isolation level identity key. See CommonsOJBLockManager
.
public org.apache.ojb.broker.locking.CommonsOJBLockManager.OJBLock createIsolationLevel(java.lang.Object resourceId, java.lang.Object isolationId, LoggerFacade logger)
org.apache.commons.transaction.locking.GenericLock
based
org.apache.commons.transaction.locking.MultiLevelLock2
instances
dependend on the specified isolation identity object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |