Search in sources :

Example 11 with ServerTransaction

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;
}
Also used : ServerTransaction(com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction) SystemException(org.omg.CORBA.SystemException)

Example 12 with ServerTransaction

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();
    }
}
Also used : SystemException(org.omg.CORBA.SystemException) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) UNKNOWN(org.omg.CORBA.UNKNOWN) ServerTransaction(com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction) SystemException(org.omg.CORBA.SystemException)

Example 13 with ServerTransaction

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();
    }
}
Also used : SystemException(org.omg.CORBA.SystemException) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) BAD_OPERATION(org.omg.CORBA.BAD_OPERATION) UNKNOWN(org.omg.CORBA.UNKNOWN) ServerTransaction(com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction) TRANSACTION_ROLLEDBACK(org.omg.CORBA.TRANSACTION_ROLLEDBACK) HeuristicMixed(org.omg.CosTransactions.HeuristicMixed) HeuristicHazard(org.omg.CosTransactions.HeuristicHazard) SystemException(org.omg.CORBA.SystemException)

Example 14 with ServerTransaction

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;
}
Also used : INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) RecoveryCoordinator(org.omg.CosTransactions.RecoveryCoordinator) Inactive(org.omg.CosTransactions.Inactive) ServerTransaction(com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction) TRANSACTION_ROLLEDBACK(org.omg.CORBA.TRANSACTION_ROLLEDBACK) SystemException(org.omg.CORBA.SystemException)

Example 15 with ServerTransaction

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();
}
Also used : SystemException(org.omg.CORBA.SystemException) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) UNKNOWN(org.omg.CORBA.UNKNOWN) ServerTransaction(com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction) TRANSACTION_ROLLEDBACK(org.omg.CORBA.TRANSACTION_ROLLEDBACK) HeuristicHazard(org.omg.CosTransactions.HeuristicHazard) SystemException(org.omg.CORBA.SystemException)

Aggregations

ServerTransaction (com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction)17 Uid (com.arjuna.ats.arjuna.common.Uid)8 SystemException (org.omg.CORBA.SystemException)8 Test (org.junit.Test)7 INVALID_TRANSACTION (org.omg.CORBA.INVALID_TRANSACTION)7 HeuristicHazard (org.omg.CosTransactions.HeuristicHazard)5 HeuristicMixed (org.omg.CosTransactions.HeuristicMixed)4 TRANSACTION_ROLLEDBACK (org.omg.CORBA.TRANSACTION_ROLLEDBACK)3 UNKNOWN (org.omg.CORBA.UNKNOWN)3 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)2 HeuristicCommit (org.omg.CosTransactions.HeuristicCommit)2 RecoveryCoordinator (org.omg.CosTransactions.RecoveryCoordinator)2 BasicAction (com.arjuna.ats.arjuna.coordinator.BasicAction)1 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)1 ArjunaTransactionImple (com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple)1 ServerSynchronization (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.ServerSynchronization)1 AssumedCompleteHeuristicServerTransaction (com.arjuna.ats.internal.jts.recovery.transactions.AssumedCompleteHeuristicServerTransaction)1 com.hp.mwtests.ts.jts.orbspecific.resources.demosync (com.hp.mwtests.ts.jts.orbspecific.resources.demosync)1 BAD_OPERATION (org.omg.CORBA.BAD_OPERATION)1 HeuristicRollback (org.omg.CosTransactions.HeuristicRollback)1