use of com.arjuna.ats.internal.txoj.LockList in project narayana by jbosstm.
the class LockManager method 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.
*/
public boolean propagate(Uid from, Uid to) {
if (txojLogger.logger.isTraceEnabled()) {
txojLogger.logger.trace("LockManager::propagate(" + from + ", " + to + ")");
}
boolean result = false;
int retryCount = 10;
if (lockMutex()) {
do {
try {
synchronized (locksHeldLockObject) {
if (loadState()) {
LockList oldlist = locksHeld;
Lock current = null;
locksHeld = new LockList();
if (locksHeld != null) {
while ((current = oldlist.pop()) != null) {
if (current.getCurrentOwner().equals(from)) {
current.propagate();
}
if (!locksHeld.insert(current)) {
current = null;
}
}
oldlist = null;
/* get rid of old lock list */
result = true;
} else {
/*
* Cannot create new locklist - abort and try again.
*/
freeState();
throw new NullPointerException();
}
}
if (result) {
result = unloadState();
}
}
} catch (NullPointerException e) {
result = false;
}
if (!result) {
if (tsLogger.logger.isTraceEnabled()) {
tsLogger.logger.trace("LockManager.propagate() Dozing");
}
conflictManager.wait(1, LockManager.DOZE_TIME);
}
} while ((!result) && (--retryCount > 0));
if (!result) {
txojLogger.i18NLogger.warn_LockManager_1();
synchronized (locksHeldLockObject) {
freeState();
}
}
unlockMutex();
}
return result;
}
use of com.arjuna.ats.internal.txoj.LockList in project narayana by jbosstm.
the class LockListIteratorUnitTest method test.
@Test
public void test() throws Exception {
LockList list = new LockList();
LockListIterator iter = new LockListIterator(list);
assertEquals(iter.iterate(), null);
iter.reset();
}
Aggregations