Search in sources :

Example 1 with SubtransactionsUnavailable

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;
}
Also used : NO_MEMORY(org.omg.CORBA.NO_MEMORY) SystemException(org.omg.CORBA.SystemException) ControlWrapper(com.arjuna.ats.internal.jts.ControlWrapper) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) Inactive(org.omg.CosTransactions.Inactive) SystemException(org.omg.CORBA.SystemException) UserException(org.omg.CORBA.UserException) SubtransactionsUnavailable(org.omg.CosTransactions.SubtransactionsUnavailable) Unavailable(org.omg.CosTransactions.Unavailable)

Aggregations

ControlWrapper (com.arjuna.ats.internal.jts.ControlWrapper)1 INVALID_TRANSACTION (org.omg.CORBA.INVALID_TRANSACTION)1 NO_MEMORY (org.omg.CORBA.NO_MEMORY)1 SystemException (org.omg.CORBA.SystemException)1 UserException (org.omg.CORBA.UserException)1 Inactive (org.omg.CosTransactions.Inactive)1 SubtransactionsUnavailable (org.omg.CosTransactions.SubtransactionsUnavailable)1 Unavailable (org.omg.CosTransactions.Unavailable)1