Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.arjuna.ats.txoj
Class LockManager

    java.lang.Object
      com.arjuna.ats.arjuna.StateManager
          com.arjuna.ats.txoj.LockManager

public class LockManager
extends StateManager

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:
  `StateManager`

Field Summary
`static int` | `defaultRetry` The default retry value which will be used by setlock if no other value is given.
`static int` | `defaultSleepTime` The default timeout value which will be used by setlock if no other value is given.
`protected LockManagerAttribute` | `lmAttributes`
`static int` | `waitTotalTimeout` By 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, objectName, objectUid, smAttributes, usingActions`

Constructor Summary
`protected` | `LockManager()`
`protected` | `LockManager(int ot)`
`protected` | `LockManager(int ot, ObjectName attr)`
`protected` | `LockManager(Uid storeUid)`
`protected` | `LockManager(Uid storeUid, int ot)`
`protected` | `LockManager(Uid storeUid, int ot, ObjectName attr)`
`protected` | `LockManager(Uid storeUid, ObjectName attr)`

Method Summary
`java.lang.Object` | `attributes()`
`void` | `finalize()` Cleanup.
`void` | `print(java.io.PrintWriter strm)` Print information about this instance on the specified `PrintWriter`.
`void` | `printState(java.io.PrintWriter strm)` Load state into object prior to doing the printing.
`boolean` | `propagate(Uid from, Uid to)` Change lock ownership as nested action commits.
`boolean` | `releaseAll(Uid actionUid)` Clear out all locks for a given action.
`boolean` | `releaselock(Uid lockUid)` Release a SINGLE LOCK lock that has the given uid.
`int` | `setlock(Lock toSet)`
`int` | `setlock(Lock toSet, int retry)`
`int` | `setlock(Lock toSet, int retry, int sleepTime)`
`protected void` | `terminate()` This method *must* be called in the finalizer of every object.
`java.lang.String` | `type()` Overload StateManager.type()

Methods inherited from class com.arjuna.ats.arjuna.StateManager
`activate, activate, cleanup, deactivate, deactivate, deactivate, destroy, disable, forgetAction, get_uid, getMutex, getStore, getStoreRoot, loadObjectState, lockMutex, modified, ObjectType, packHeader, persist, rememberAction, restore_state, save_state, setStatus, setupStore, setupStore, status, tryLockMutex, unlockMutex, unpackHeader`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### defaultRetry

    public static final int defaultRetry

  The default retry value which will be used by setlock if no other value is given.

  See Also:
    `setlock(com.arjuna.ats.txoj.Lock)`, Constant Field Values

### defaultSleepTime

    public static final int defaultSleepTime

  The default timeout value which will be used by setlock if no other value is given.

  See Also:
    `setlock(com.arjuna.ats.txoj.Lock)`, Constant Field Values

### waitTotalTimeout

    public static final int waitTotalTimeout

  By 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:
    `setlock(com.arjuna.ats.txoj.Lock)`, Constant Field Values

### lmAttributes

    protected LockManagerAttribute lmAttributes

Constructor Detail

### LockManager

    protected LockManager(Uid storeUid)

### LockManager

    protected LockManager(Uid storeUid,
                          ObjectName attr)

### LockManager

    protected LockManager(Uid storeUid,
                          int ot)

### LockManager

    protected LockManager(Uid storeUid,
                          int ot,
                          ObjectName attr)

### LockManager

    protected LockManager()

### LockManager

    protected LockManager(int ot)

### LockManager

    protected LockManager(int ot,
                          ObjectName attr)

Method Detail

### finalize

    public void finalize()
                  throws java.lang.Throwable

  Cleanup. Note we grab the semaphore before destroying the the lock store to ensure the store is deleted cleanly.

  Overrides:
    `finalize` in class `StateManager`
  Throws:
    `java.lang.Throwable`

### propagate

    public final boolean propagate(Uid from,
                                   Uid to)

  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

    public final boolean releaseAll(Uid actionUid)

  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

    public final boolean releaselock(Uid lockUid)

  Release a SINGLE LOCK lock that has the given uid. Breaks two-phase locking rules so watch out!

### setlock

    public final int setlock(Lock toSet)

### setlock

    public final int setlock(Lock toSet,
                             int retry)

### setlock

    public final int setlock(Lock toSet,
                             int retry,
                             int sleepTime)

### print

    public void print(java.io.PrintWriter strm)

  Print information about this instance on the specified `PrintWriter`.

  Overrides:
    `print` in class `StateManager`

### printState

    public void printState(java.io.PrintWriter strm)

  Load state into object prior to doing the printing.

### type

    public java.lang.String type()

  Overload StateManager.type()

  Overrides:
    `type` in class `StateManager`

### attributes

    public java.lang.Object attributes()

  Overrides:
    `attributes` in class `StateManager`
  Returns:
    the `LockManagerAttribute` object for this instance. Must be returned as an `Object` because it overrides StateManager.attributes.
  See Also:
    `LockManagerAttribute`

### 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:
    `terminate` in class `StateManager`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD