}
catch (Exception e)
{
}
throw new TRANSACTION_ROLLEDBACK();
}
InterposedHierarchy newElement = new InterposedHierarchy((ServerStrictTopLevelAction) action);
_head.add(newElement);
if (depth > 0) // current is a nested transaction
{
/*
* Now deal with any nested transactions.
* As we create, register with the original transactions.
*/
ServerResource nestedAction = null;
for (int i = depth -2; i >= 0; i--)
{
tmpCoord = ctx.parents[i].coord;
tmpTerm = ctx.parents[i].term;
control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.parents[i].otid),
tmpCoord, tmpTerm, control);
nestedAction = new ServerStrictNestedAction(control, false); // not current, so don't register
if (!nestedAction.valid())
{
/*
* Just deal with current transaction. Others must have been
* registered successfully, and will be deal with automatically
* when the parent transaction terminates.
*/
try
{
((ServerStrictNestedAction) nestedAction).rollback_subtransaction(); // does dispose as well!
nestedAction = null;
}
catch (Exception e)
{
}
throw new TRANSACTION_ROLLEDBACK();
}
/*
* Add transaction resource to list.
*/
action.addChild((ServerStrictNestedAction) nestedAction);
action = nestedAction;
}
/*
* Now deal with current transaction. If there is
* only one transaction we do nothing.
*/
tmpCoord = ctx.current.coord;
tmpTerm = ctx.current.term;
control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.current.otid),
tmpCoord, tmpTerm, control);
nestedAction = new ServerStrictNestedAction(control, true); // current, so register
if (!nestedAction.valid())
{
/*
* Just deal with current transaction. Others must have been
* registered successfully, and will be deal with automatically
* when the parent transaction terminates.
*/
try
{
((ServerStrictNestedAction) nestedAction).rollback_subtransaction(); // does dispose as well!
nestedAction = null;
}
catch (Exception e)
{
}
throw new TRANSACTION_ROLLEDBACK();
}
action.addChild((ServerStrictNestedAction) nestedAction);
}