use of org.omg.CosTransactions.SubtransactionsUnavailable in project narayana by jbosstm.
the class CurrentImple method begin.
public void begin() throws SubtransactionsUnavailable, SystemException {
ControlWrapper currentAction = _theManager.current();
if (// no current, so create top-level action
currentAction == null) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("CurrentImple::begin - creating new top-level transaction.");
}
if (OTSImpleManager.localFactory())
currentAction = new ControlWrapper(OTSImpleManager.factory().createLocal(get_timeout()));
else
currentAction = new ControlWrapper(OTSImpleManager.get_factory().create(get_timeout()));
} else {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("CurrentImple::begin - creating new subtransaction.");
}
try {
currentAction = currentAction.create_subtransaction();
} catch (Unavailable ex) {
throw new INVALID_TRANSACTION(ExceptionCodes.UNAVAILABLE_COORDINATOR, CompletionStatus.COMPLETED_NO);
} catch (Inactive e) {
throw new INVALID_TRANSACTION(ExceptionCodes.INACTIVE_TRANSACTION, CompletionStatus.COMPLETED_NO);
} catch (NO_MEMORY nme) {
System.gc();
throw nme;
} catch (SystemException sysEx) {
throw new INVALID_TRANSACTION(ExceptionCodes.INACTIVE_TRANSACTION, CompletionStatus.COMPLETED_NO);
} catch (OutOfMemoryError me) {
System.gc();
throw new NO_MEMORY(0, CompletionStatus.COMPLETED_NO);
}
}
_theManager.pushAction(currentAction);
try {
ThreadAssociationControl.updateAssociation(currentAction, TX_BEGUN);
} catch (Exception e) {
try {
rollback_only();
} catch (Exception ex) {
}
}
currentAction = null;
}
Aggregations