package com.arjuna.ats.txoj;
This class provides (transactional) concurrency control for application
objects.
The default retry value which will be used by setlock if no other value
is given.
The default timeout value which will be used by setlock if no other value
is given.
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.
Cleanup. Note we grab the semaphore before destroying the the lock store
to ensure the store is deleted cleanly.
boolean doSignal = false;
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.
synchronized (syncObject)
while ((current = oldlist.pop()) != null)
while ((!result) && (--retryCount > 0));
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.
Release a SINGLE LOCK lock that has the given uid. Breaks two-phase
locking rules so watch out!
public int setlock (Lock toSet, int retry, int sleepTime)
boolean modifyRequired = false;
synchronized (syncObject)
newLockR = new LockRecord(this, (modifyRequired ? false : true), currAct);
Print information about this instance on the specified
PrintWriter
.
while ((current = next.iterate()) != null)
strm.println("Currently holding : 0 locks");
Load state into object prior to doing the printing.
boolean iDeleteState = false;
Overload StateManager.type()
return "StateManager/LockManager";
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.
boolean releasedOK = false;
synchronized (syncObject)
while ((current = next.iterate()) != null)
int unloadRetryCount = 10;
while ((--unloadRetryCount > 0) && (!releasedOK));
while ((!result) && (--retryCount > 0));
boolean cleanLoad = true;
for (int i = 0; (i < count) && cleanLoad; i++)
boolean matching = false;
while ((heldLock = next.iterate()) != null)
if (heldLock.equals(otherLock))
boolean unloadOk = false;