|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.transaction.locking.GenericLockManager
org.apache.ojb.broker.locking.CommonsOJBLockManager
class CommonsOJBLockManager
Extension of GenericLockManager to
support all locking isolation level defined in OJB locking api and a provider of
specific 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.
| Nested Class Summary | |
|---|---|
(package private) static class |
CommonsOJBLockManager.OJBLock
Abstract base class to implement the different GenericLock
extension classes representing the OJB isolation levels (e.g. |
(package private) static class |
CommonsOJBLockManager.ReadCommitedLock
Implementation of isolation level IsolationLevels.IL_READ_COMMITTED. |
(package private) static class |
CommonsOJBLockManager.ReadUncommittedLock
Implementation of isolation level IsolationLevels.IL_READ_UNCOMMITTED. |
(package private) static class |
CommonsOJBLockManager.RepeadableReadsLock
Implementation of isolation level IsolationLevels.IL_REPEATABLE_READ. |
(package private) static class |
CommonsOJBLockManager.SerializeableLock
Implementation of isolation level IsolationLevels.IL_SERIALIZABLE. |
| Field Summary | |
|---|---|
(package private) static int |
COMMON_READ_LOCK
|
(package private) static int |
COMMON_UPGRADE_LOCK
|
(package private) static int |
COMMON_WRITE_LOCK
|
| Fields inherited from class org.apache.commons.transaction.locking.GenericLockManager |
|---|
checkThreshhold, DEFAULT_CHECK_THRESHHOLD, DEFAULT_TIMEOUT, effectiveGlobalTimeouts, globalLocks, globalOwners, globalTimeoutMSecs, logger, maxLockLevel, timedOutOwners |
| Constructor Summary | |
|---|---|
CommonsOJBLockManager(org.apache.commons.transaction.util.LoggerFacade logger,
long timeoutMSecs,
long checkThreshholdMSecs)
|
|
| Method Summary | |
|---|---|
org.apache.commons.transaction.locking.MultiLevelLock |
atomicGetOrCreateLock(Object resourceId)
|
CommonsOJBLockManager.OJBLock |
atomicGetOrCreateLock(Object resourceId,
Object isolationId)
Either gets an existing lock on the specified resource or creates one if none exists. |
CommonsOJBLockManager.OJBLock |
createIsolationLevel(Object resourceId,
Object isolationId,
org.apache.commons.transaction.util.LoggerFacade logger)
Creates GenericLock based
MultiLevelLock2 instances
dependend on the specified isolation identity object. |
protected org.apache.commons.transaction.locking.GenericLock |
createLock(Object resourceId)
|
protected org.apache.commons.transaction.locking.GenericLock |
createLock(Object resourceId,
Object isolationId)
|
void |
lock(Object ownerId,
Object resourceId,
int targetLockLevel,
int compatibility,
boolean preferred,
long timeoutMSecs)
|
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. |
(package private) int |
mapLockLevelDependendOnIsolationLevel(Integer isolationId,
int lockLevel)
Helper method to map the specified common lock level (e.g like COMMON_READ_LOCK, #COMMON_UPGRADE_LOCK, ...) based
on the isolation level to the internal used lock level value by the
MultiLevelLock2 implementation. |
boolean |
tryLock(Object ownerId,
Object resourceId,
int targetLockLevel,
boolean reentrant)
|
boolean |
tryLock(Object ownerId,
Object resourceId,
int targetLockLevel,
boolean reentrant,
Object isolationId)
Tries to acquire a lock on a resource. |
| Methods inherited from class org.apache.commons.transaction.locking.GenericLockManager |
|---|
addOwner, checkLock, doLock, getAll, getLevel, getLock, getLocks, getNextGlobalConflictTimeout, hasLock, lock, lock, release, releaseAll, releaseAllNoTimeOutReset, releaseTimedOutOwners, removeLock, removeOwner, startGlobalTimeout, timeOut, timeoutCheck, toString, wouldDeadlock |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final int COMMON_READ_LOCK
static final int COMMON_WRITE_LOCK
static final int COMMON_UPGRADE_LOCK
| Constructor Detail |
|---|
public CommonsOJBLockManager(org.apache.commons.transaction.util.LoggerFacade logger,
long timeoutMSecs,
long checkThreshholdMSecs)
throws IllegalArgumentException
IllegalArgumentException| Method Detail |
|---|
public boolean tryLock(Object ownerId,
Object resourceId,
int targetLockLevel,
boolean reentrant)
tryLock in interface org.apache.commons.transaction.locking.LockManager2tryLock in class org.apache.commons.transaction.locking.GenericLockManagerGenericLockManager.tryLock(Object, Object, int, boolean)
public boolean tryLock(Object ownerId,
Object resourceId,
int targetLockLevel,
boolean reentrant,
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 otherwise
public void lock(Object ownerId,
Object resourceId,
int targetLockLevel,
int compatibility,
boolean preferred,
long timeoutMSecs)
throws org.apache.commons.transaction.locking.LockException
lock in interface org.apache.commons.transaction.locking.LockManager2lock in class org.apache.commons.transaction.locking.GenericLockManagerorg.apache.commons.transaction.locking.LockExceptionGenericLockManager.lock(Object, Object, int, int, boolean, long)
public void lock(Object ownerId,
Object resourceId,
int targetLockLevel,
int compatibility,
boolean preferred,
long timeoutMSecs,
Object isolationId)
throws org.apache.commons.transaction.locking.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 - MultiLevelLock2.COMPATIBILITY_NONEif no additional compatibility is
desired (same as reentrant set to false) ,
MultiLevelLock2.COMPATIBILITY_REENTRANTif lock level by the same
owner shall not affect compatibility (same as reentrant set to
true), or MultiLevelLock2.COMPATIBILITY_SUPPORTif lock levels that
are the same as the desired shall not affect compatibility, or
finally MultiLevelLock2.COMPATIBILITY_REENTRANT_AND_SUPPORTwhich 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.
org.apache.commons.transaction.locking.LockException - will be thrown when the lock can not be acquiredpublic org.apache.commons.transaction.locking.MultiLevelLock atomicGetOrCreateLock(Object resourceId)
atomicGetOrCreateLock in interface org.apache.commons.transaction.locking.LockManageratomicGetOrCreateLock in class org.apache.commons.transaction.locking.GenericLockManagerGenericLockManager.atomicGetOrCreateLock(Object)
public CommonsOJBLockManager.OJBLock atomicGetOrCreateLock(Object resourceId,
Object isolationId)
resourceId - the resource to get or create the lock onisolationId - the isolation level identity key. See CommonsOJBLockManager.
protected org.apache.commons.transaction.locking.GenericLock createLock(Object resourceId)
createLock in class org.apache.commons.transaction.locking.GenericLockManagerGenericLockManager.createLock(Object)
protected org.apache.commons.transaction.locking.GenericLock createLock(Object resourceId,
Object isolationId)
public CommonsOJBLockManager.OJBLock createIsolationLevel(Object resourceId,
Object isolationId,
org.apache.commons.transaction.util.LoggerFacade logger)
GenericLock based
MultiLevelLock2 instances
dependend on the specified isolation identity object.
int mapLockLevelDependendOnIsolationLevel(Integer isolationId,
int lockLevel)
COMMON_READ_LOCK, #COMMON_UPGRADE_LOCK, ...) based
on the isolation level to the internal used lock level value by the
MultiLevelLock2 implementation.
isolationId - lockLevel -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||