Package com.arjuna.ats.txoj
Class LockManager
java.lang.Object
com.arjuna.ats.arjuna.StateManager
com.arjuna.ats.txoj.LockManager
This class provides (transactional) concurrency control for application
objects.
- Since:
- JTS 1.0.
- Version:
- $Id: LockManager.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark@arjuna.com)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.arjuna.ats.internal.txoj.LockConflictManagerstatic final intThe default retry value which will be used by setlock if no other value is given.static final intThe default timeout value which will be used by setlock if no other value is given.protected static final intprotected booleanprotected com.arjuna.ats.internal.txoj.LockListprotected final Objectprotected LockStoreprotected Stringprotected ReentrantLockprotected static final booleanprotected booleanprotected booleanprotected Stringstatic final intBy default, threads which call setlock with conflicting locks will spin for the specified (or default) number of timeout and retry attempts, and then return failure if the lock could not be acquired.Fields inherited from class com.arjuna.ats.arjuna.StateManager
modifyingActions, objectModel, objectUid, synchronizationLock, usingActions -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedLockManager(int ot) protectedLockManager(int ot, int om) protectedLockManager(Uid storeUid) protectedLockManager(Uid storeUid, int ot) protectedLockManager(Uid storeUid, int ot, int om) -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidcleanUp()protected booleanvoidfinalize()Cleanup.protected final voidprotected final booleanprotected final booleanisAncestorOf(Lock heldLock) protected booleanprotected final intlockConflict(Lock otherLock) voidprint(PrintWriter strm) Print information about this instance on the specifiedPrintWriter.voidprintState(PrintWriter strm) Load state into object prior to doing the printing.booleanChange lock ownership as nested action commits.final booleanreleaseAll(Uid actionUid) Clear out all locks for a given action.final booleanreleaselock(Uid lockUid) Release a SINGLE LOCK lock that has the given uid.final intfinal intintprotected voidThis method *must* be called in the finalizer of every object.type()Overload StateManager.type()protected final booleanMethods inherited from class com.arjuna.ats.arjuna.StateManager
activate, activate, cleanup, createLists, deactivate, deactivate, deactivate, destroy, disable, forgetAction, get_uid, getCreationTimeMillis, getMutex, getObjectModel, getStore, getStoreRoot, loadObjectState, lockMutex, modified, objectType, packHeader, persist, rememberAction, restore_state, save_state, setStatus, setupStore, setupStore, setupStore, status, tryLockMutex, unlockMutex, unpackHeader
-
Field Details
-
defaultRetry
public static final int defaultRetryThe default retry value which will be used by setlock if no other value is given.- See Also:
-
defaultSleepTime
public static final int defaultSleepTimeThe default timeout value which will be used by setlock if no other value is given. Milliseconds.- See Also:
-
waitTotalTimeout
public static final int waitTotalTimeoutBy default, threads which call setlock with conflicting locks will spin for the specified (or default) number of timeout and retry attempts, and then return failure if the lock could not be acquired. If the *retry* period is set to this value, then such threads will sleep for their total wait period and be signalled if the lock is released within this period of time.- Since:
- JTS 2.1.
- See Also:
-
lockStoreType
-
systemKey
-
locksHeld
protected com.arjuna.ats.internal.txoj.LockList locksHeld -
locksHeldLockObject
-
lockStore
-
stateLoaded
protected boolean stateLoaded -
hasBeenLocked
protected boolean hasBeenLocked -
objectLocked
protected boolean objectLocked -
mutex
-
conflictManager
protected com.arjuna.ats.internal.txoj.LockConflictManager conflictManager -
DOZE_TIME
protected static final int DOZE_TIME- See Also:
-
nestedLocking
protected static final boolean nestedLocking
-
-
Constructor Details
-
LockManager
-
LockManager
-
LockManager
-
LockManager
protected LockManager() -
LockManager
protected LockManager(int ot) -
LockManager
protected LockManager(int ot, int om)
-
-
Method Details
-
finalize
Cleanup. Note we grab the semaphore before destroying the lock store to ensure the store is deleted cleanly. -
propagate
Change lock ownership as nested action commits. All locks owned by the committing action have their owners changed to be the parent of the committing action. BasicAction ensures this is only called at nested commit. This function works by copying the old LockList pointer and then creating a new held lock list. Locks are then moved from the old to the new, propagating en route. -
releaseAll
Clear out all locks for a given action. Should be triggered automatically at top-level commit but is also user callable so is potentially dangerous. -
releaselock
Release a SINGLE LOCK lock that has the given uid. Breaks two-phase locking rules so watch out! -
setlock
-
setlock
-
setlock
-
print
Print information about this instance on the specifiedPrintWriter.- Overrides:
printin classStateManager
-
printState
Load state into object prior to doing the printing. -
type
Overload StateManager.type()- Overrides:
typein classStateManager
-
terminate
protected void terminate()This method *must* be called in the finalizer of every object. It ensures that any necessary cleanup work is done in the event that the object goes out of scope within a transaction.- Overrides:
terminatein classStateManager
-
cleanUp
protected final void cleanUp() -
doRelease
-
freeState
protected final void freeState() -
initialise
protected final boolean initialise() -
isAncestorOf
-
loadState
protected boolean loadState() -
lockConflict
-
unloadState
protected final boolean unloadState()
-