Search in sources :

Example 36 with UNKNOWN

use of org.omg.CORBA.UNKNOWN in project narayana by jbosstm.

the class ContextManager method createProxy.

public final ControlWrapper createProxy(org.omg.CORBA.Any ctx) throws SystemException {
    String stringRef = null;
    try {
        stringRef = ctx.extract_string();
        if (stringRef.startsWith(IORTag)) {
            org.omg.CORBA.Object obj = ORBManager.getORB().orb().string_to_object(stringRef);
            Coordinator theCoordinator = org.omg.CosTransactions.CoordinatorHelper.narrow(obj);
            if (theCoordinator == null)
                throw new BAD_PARAM();
            return new ControlWrapper(TransactionFactoryImple.createProxy(theCoordinator, null));
        } else
            return null;
    } catch (BAD_PARAM e1) {
        jtsLogger.i18NLogger.warn_context_genfail("ContextManager " + stringRef, e1);
    } catch (Exception e2) {
        jtsLogger.i18NLogger.warn_context_genfail("ContextManager", e2);
        throw new UNKNOWN(e2.toString());
    }
    return null;
}
Also used : ControlWrapper(com.arjuna.ats.internal.jts.ControlWrapper) BAD_PARAM(org.omg.CORBA.BAD_PARAM) UNKNOWN(org.omg.CORBA.UNKNOWN) Coordinator(org.omg.CosTransactions.Coordinator) SystemException(org.omg.CORBA.SystemException) EmptyStackException(java.util.EmptyStackException)

Example 37 with UNKNOWN

use of org.omg.CORBA.UNKNOWN in project narayana by jbosstm.

the class TransactionFactoryImple method getTransactionInfo.

/**
 * @return information on a specific transaction.
 * @since JTS 2.1.2.
 */
public TransactionInfo getTransactionInfo(Uid u) throws org.omg.CosTransactions.NoTransaction, SystemException {
    if (!u.valid())
        throw new BAD_PARAM(jtsLogger.i18NLogger.get_orbspecific_invaliduid() + " " + u);
    else {
        try {
            synchronized (ControlImple.allControls) {
                ControlImple ctx = (ControlImple) ControlImple.allControls.get(u);
                if (ctx != null) {
                    TransactionInfo info = new TransactionInfo();
                    info.currentDepth = ctx.getImplHandle().getHierarchy().depth();
                    TransactionReaper reaper = TransactionReaper.transactionReaper();
                    info.timeout = reaper.getTimeout(ctx);
                    info.numberOfThreads = ctx.getImplHandle().activeThreads();
                    return info;
                } else
                    throw new NoTransaction();
            }
        } catch (NoTransaction ex) {
            throw ex;
        } catch (Exception e) {
            e.printStackTrace();
            throw new UNKNOWN();
        }
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) BAD_PARAM(org.omg.CORBA.BAD_PARAM) TransactionInfo(com.arjuna.ArjunaOTS.TransactionInfo) GlobalTransactionInfo(com.arjuna.ArjunaOTS.GlobalTransactionInfo) UNKNOWN(org.omg.CORBA.UNKNOWN) TransactionReaper(com.arjuna.ats.arjuna.coordinator.TransactionReaper) SystemException(org.omg.CORBA.SystemException) ObjectStoreException(com.arjuna.ats.arjuna.exceptions.ObjectStoreException)

Example 38 with UNKNOWN

use of org.omg.CORBA.UNKNOWN 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 39 with UNKNOWN

use of org.omg.CORBA.UNKNOWN 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 40 with UNKNOWN

use of org.omg.CORBA.UNKNOWN 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

UNKNOWN (org.omg.CORBA.UNKNOWN)51 SystemException (org.omg.CORBA.SystemException)32 BAD_PARAM (org.omg.CORBA.BAD_PARAM)27 Coordinator (org.omg.CosTransactions.Coordinator)15 ControlWrapper (com.arjuna.ats.internal.jts.ControlWrapper)14 AcsJNoPermissionEx (alma.maciErrType.wrappers.AcsJNoPermissionEx)13 BadParametersException (com.cosylab.acs.maci.BadParametersException)13 CoreException (com.cosylab.acs.maci.CoreException)13 NoResourcesException (com.cosylab.acs.maci.NoResourcesException)13 NO_RESOURCES (org.omg.CORBA.NO_RESOURCES)12 Unavailable (org.omg.CosTransactions.Unavailable)11 Any (org.omg.CORBA.Any)9 Object (org.omg.CORBA.Object)8 URI (java.net.URI)7 URISyntaxException (java.net.URISyntaxException)7 AcsJCannotGetComponentEx (alma.maciErrType.wrappers.AcsJCannotGetComponentEx)6 BAD_OPERATION (org.omg.CORBA.BAD_OPERATION)6 INVALID_TRANSACTION (org.omg.CORBA.INVALID_TRANSACTION)6 TRANSACTION_REQUIRED (org.omg.CORBA.TRANSACTION_REQUIRED)6 TRANSACTION_ROLLEDBACK (org.omg.CORBA.TRANSACTION_ROLLEDBACK)6