use of com.arjuna.ats.internal.txoj.abstractrecords.CadaverLockRecord in project narayana by jbosstm.
the class LockManager method cleanUp.
protected final void cleanUp() {
if (txojLogger.logger.isTraceEnabled()) {
txojLogger.logger.trace("LockManager::cleanUp() for object-id " + get_uid());
}
if (lockMutex()) {
if (hasBeenLocked) {
if ((super.objectModel == ObjectModel.MULTIPLE) && (systemKey == null)) {
initialise();
}
/*
* Unlike in the original version of Arjuna, we don't check to see
* if the invoking thread is within a transaction. We look at
* whether this object has been used within a transaction, and then
* act accordingly.
*/
BasicAction current = BasicAction.Current();
synchronized (super.usingActions) {
if (super.usingActions != null) {
Enumeration e = super.usingActions.elements();
while (e.hasMoreElements()) {
BasicAction action = (BasicAction) e.nextElement();
if (// shouldn't be null!!
action != null) {
/*
* Pop actions off using list. Don't check if action
* is running below so that cadavers can be created
* in commit protocol too.
*/
/*
* We need to create a cadaver lock record to
* maintain the locks because this object is being
* deleted.
*/
AbstractRecord A = new CadaverLockRecord(lockStore, this, action);
if (action.add(A) != AddOutcome.AR_ADDED) {
A = null;
}
}
}
}
}
hasBeenLocked = false;
}
unlockMutex();
}
}
use of com.arjuna.ats.internal.txoj.abstractrecords.CadaverLockRecord in project narayana by jbosstm.
the class CadaverUnitTest method testBasic.
@Test
public void testBasic() throws Exception {
AtomicAction A = new AtomicAction();
AtomicObject B = new AtomicObject();
A.begin();
CadaverLockRecord clr = new CadaverLockRecord(null, B, A);
LockRecord lr = new LockRecord(B, A);
assertTrue(clr.type() != null);
clr.print(new PrintWriter(new ByteArrayOutputStream()));
clr.replace(lr);
A.abort();
}
Aggregations