use of com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction in project narayana by jbosstm.
the class SubordinateAtomicTransaction method doRollback.
/**
* @return ActionStatus
* @throws SystemException
*/
public int doRollback() throws SystemException {
ServerTransaction stx = getTransaction();
int outcome = ActionStatus.INVALID;
try {
if (stx != null)
return stx.doPhase2Abort();
} catch (final Exception ex) {
ex.printStackTrace();
}
return ActionStatus.H_HAZARD;
}
use of com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction in project narayana by jbosstm.
the class ServerNestedAction method rollback_subtransaction.
public void rollback_subtransaction() throws SystemException {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ServerNestedAction::rollback_subtransaction : " + _theUid);
}
if (_theControl == null) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_nullcontrol_2("ServerNestedAction.rollback_subtransaction");
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO);
}
if (_theControl.isWrapper()) {
destroyResource();
return;
}
ServerTransaction theTransaction = (ServerTransaction) _theControl.getImplHandle();
try {
if (!valid())
theTransaction.doPhase2Abort();
else
theTransaction.rollback();
} catch (SystemException e) {
throw e;
} catch (Exception ex) {
throw new UNKNOWN(ex.toString());
} finally {
ThreadActionData.popAction();
destroyResource();
}
}
use of com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction in project narayana by jbosstm.
the class ServerNestedAction method commit_subtransaction.
public void commit_subtransaction(Coordinator parent) throws SystemException {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ServerNestedAction::commit_subtransaction : " + _theUid);
}
if (_theControl == null) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_nullcontrol_1("ServerNestedAction.commit_subtransaction");
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO);
}
if (_theControl.isWrapper()) {
destroyResource();
return;
}
ServerTransaction theTransaction = (ServerTransaction) _theControl.getImplHandle();
try {
theTransaction.commit(false);
} catch (TRANSACTION_ROLLEDBACK e1) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e1);
throw e1;
} catch (INVALID_TRANSACTION e5) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e5);
throw e5;
} catch (HeuristicMixed e2) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e2);
throw new BAD_OPERATION(ExceptionCodes.HEURISTIC_COMMIT, CompletionStatus.COMPLETED_MAYBE);
} catch (HeuristicHazard e3) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e3);
throw new BAD_OPERATION(ExceptionCodes.HEURISTIC_COMMIT, CompletionStatus.COMPLETED_MAYBE);
} catch (SystemException e4) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e4);
throw e4;
} catch (Exception e5) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e5);
throw new UNKNOWN(e5.toString());
} finally {
ThreadActionData.popAction();
destroyResource();
}
}
use of com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction in project narayana by jbosstm.
the class ServerTopLevelAction method registerResource.
protected boolean registerResource(Coordinator theCoordinator) {
boolean result = false;
if (theCoordinator != null) {
if (_registered)
return true;
try {
/*
* Register resource and pass RecoveryCoordinator reference
* to the interposed transaction to save and restore.
*/
RecoveryCoordinator recoveryCoord = theCoordinator.register_resource(_resourceRef);
_registered = true;
if (!_theControl.isWrapper()) {
ServerTransaction tx = (ServerTransaction) _theControl.getImplHandle();
if (tx != null) {
tx.setRecoveryCoordinator(recoveryCoord);
result = true;
} else {
result = false;
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_ipfailed("ServerTopLevelAction");
}
} else
result = true;
} catch (ClassCastException classCastException) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror("ServerTopLevelAction.registerResource", classCastException);
} catch (Inactive ine) {
jtsLogger.i18NLogger.warn_server_top_level_action_inactive();
jtsLogger.i18NLogger.debug_orbspecific_interposition_resources_arjuna_generror("ServerTopLevelAction.registerResource", ine);
transactionInactive = true;
} catch (TRANSACTION_ROLLEDBACK ex1) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror("ServerTopLevelAction.registerResource", ex1);
} catch (INVALID_TRANSACTION ex2) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror("ServerTopLevelAction.registerResource", ex2);
} catch (Exception e) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror("ServerTopLevelAction.registerResource", e);
}
} else {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_nocoord("ServerTopLevelAction.registerResource");
}
return result;
}
use of com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction in project narayana by jbosstm.
the class ServerTopLevelAction method commit_one_phase.
public void commit_one_phase() throws HeuristicHazard, SystemException {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ServerTopLevelAction::commit_one_phase for " + _theUid);
}
if (_theControl == null) {
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO);
}
if (_theControl.isWrapper()) {
destroyResource();
return;
}
ServerTransaction theTransaction = (ServerTransaction) _theControl.getImplHandle();
if (theTransaction == null) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_notx("ServerTopLevelAction.commit_one_phase");
throw new INVALID_TRANSACTION(ExceptionCodes.NO_TRANSACTION, CompletionStatus.COMPLETED_NO);
}
// LockManager needs to know if there is a transaction
ThreadActionData.pushAction(theTransaction);
try {
/*
* This will commit and do any before/after_completion calls
* on registered synchronizations.
*/
theTransaction.doCommit(true);
} catch (HeuristicHazard e1) {
/*
* Is a heuristic, then don't remove the
* transaction information.
*/
ThreadActionData.popAction();
throw e1;
} catch (TRANSACTION_ROLLEDBACK e4) {
ThreadActionData.popAction();
throw e4;
} catch (INVALID_TRANSACTION e5) {
ThreadActionData.popAction();
throw e5;
} catch (SystemException e6) {
ThreadActionData.popAction();
throw e6;
} catch (Exception e7) {
ThreadActionData.popAction();
throw new UNKNOWN(e7.toString());
} finally {
destroyResource();
}
ThreadActionData.popAction();
destroyResource();
}
Aggregations