use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ContextManager method addControlImpleHierarchy.
/*
* Given a ControlWrapper we can create the hierarchy quickly, since
* we have the implementation information to hand.
*/
public final boolean addControlImpleHierarchy(ControlImple which) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextManager::addControlImpleHierarchy ()");
}
boolean isError = false;
try {
ControlImple curr = which.getParentImple();
Stack hier = new Stack();
while (curr != null) {
hier.push(new ControlWrapper(curr));
curr = curr.getParentImple();
}
try {
ControlWrapper wrapper = (ControlWrapper) hier.pop();
while (wrapper != null) {
pushAction(wrapper);
wrapper = null;
wrapper = (ControlWrapper) hier.pop();
}
} catch (EmptyStackException e) {
}
} catch (Exception e) {
jtsLogger.i18NLogger.warn_context_genfail("ContextManager.addActionControlImple", e);
isError = true;
}
return isError;
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class RestrictedInterposition method setupHierarchy.
/*
* Assume that all actions in the imported hierarchy are of the same type,
* i.e., all JBoss transactions. Because of the way garbage collection works
* in the ORB we have to run an explicit garbage collection phase for
* finished hierarchies.
*/
public synchronized ControlImple setupHierarchy(PropagationContext context) throws SystemException {
ControlImple controlPtr = null;
Uid theUid = null;
ServerTopLevelAction proxyAction = null;
if (context.parents.length == 0)
theUid = Utility.otidToUid(context.current.otid);
else
theUid = Utility.otidToUid(context.parents[context.parents.length - 1].otid);
proxyAction = super.present(theUid);
if (proxyAction == null) {
/*
* Create a new proxyAction element and return the "current"
* transaction.
*/
controlPtr = createHierarchy(context, theUid);
} else {
/*
* Check hierarchy of existing element.
*/
controlPtr = checkHierarchy(proxyAction, context);
}
return controlPtr;
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ServerTopLevelRestrictedUnitTest method testCommit.
@Test
public void testCommit() throws Exception {
ControlImple cont = new ControlImple(null, null);
Control theControl = cont.getControl();
ArjunaTransactionImple tx = cont.getImplHandle();
ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
ServerRestrictedTopLevelAction act = new ServerRestrictedTopLevelAction(sc);
assertTrue(act.type() != null);
assertTrue(act.child() == null);
assertTrue(act.deepestControl() != null);
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ServerTopLevelStrictUnitTest method test.
@Test
public void test() throws Exception {
ControlImple cont = new ControlImple(null, null);
Control theControl = cont.getControl();
ArjunaTransactionImple tx = cont.getImplHandle();
ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
ServerStrictTopLevelAction act = new ServerStrictTopLevelAction(sc, true);
assertTrue(act.interposeResource());
assertTrue(act.type() != null);
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ServerNestedRestrictedUnitTest method test.
@Test
public void test() throws Exception {
ControlImple cont = new ControlImple(null, null);
Control theControl = cont.getControl();
ArjunaTransactionImple tx = cont.getImplHandle();
ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
ServerRestrictedNestedAction act = new ServerRestrictedNestedAction(sc);
assertTrue(act.deepestControl() != null);
assertEquals(act.child(), null);
}
Aggregations