Search in sources :

Example 1 with NoTransaction

use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.

the class Test03 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        boolean correct = true;
        Current current = OTS.get_current();
        try {
            current.rollback();
            correct = false;
        } catch (NoTransaction noTransaction) {
        }
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Test03.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test03.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) Current(org.omg.CosTransactions.Current)

Example 2 with NoTransaction

use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.

the class Test11 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        boolean correct = true;
        Current current = OTS.get_current();
        current.begin();
        current.commit(false);
        try {
            current.rollback();
            correct = false;
        } catch (NoTransaction noTransaction) {
        }
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Test11.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test11.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) Current(org.omg.CosTransactions.Current)

Example 3 with NoTransaction

use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.

the class Test13 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        boolean correct = true;
        Current current = OTS.get_current();
        current.begin();
        current.rollback();
        try {
            current.commit(true);
            correct = false;
        } catch (NoTransaction noTransaction) {
        }
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Test13.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test13.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) Current(org.omg.CosTransactions.Current)

Example 4 with NoTransaction

use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.

the class TransactionFactoryImple method activeTransactions.

private final org.omg.CosTransactions.otid_t[] activeTransactions() throws Inactive, NoTransaction, SystemException {
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("TransactionFactoryImple::activeTransactions ()");
    }
    if (ControlImple.allControls == null)
        throw new Inactive();
    else {
        synchronized (ControlImple.allControls) {
            if (ControlImple.allControls.size() == 0)
                throw new NoTransaction();
            else {
                org.omg.CosTransactions.otid_t[] ids = new org.omg.CosTransactions.otid_t[ControlImple.allControls.size()];
                Enumeration iter = ControlImple.allControls.elements();
                int i = 0;
                while (iter.hasMoreElements()) {
                    ControlImple cont = (ControlImple) iter.nextElement();
                    if (cont != null) {
                        ids[i] = Utility.uidToOtid(cont.get_uid().stringForm());
                        i++;
                    }
                }
                return ids;
            }
        }
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) Enumeration(java.util.Enumeration) CosTransactions.otid_t(org.omg.CosTransactions.otid_t) Inactive(org.omg.CosTransactions.Inactive)

Example 5 with NoTransaction

use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.

the class AtomicTransaction method end.

/*
	 * public synchronized void begin () throws SubtransactionsUnavailable,
	 * SystemException { if (jtaxLogger.loggerI18N.isWarnEnabled()) {
	 * jtaxLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.jts.atomictxnobegin"); }
	 * 
	 * throw new INVALID_TRANSACTION(ExceptionCodes.ALREADY_BEGUN,
	 * CompletionStatus.COMPLETED_NO); }
	 */
/**
 * Does not change thread-to-tx association as base class commit does.
 */
public synchronized void end(boolean report_heuristics) throws NoTransaction, HeuristicMixed, HeuristicHazard, WrongTransaction, SystemException {
    if (jtaxLogger.logger.isTraceEnabled()) {
        jtaxLogger.logger.trace("AtomicTransaction::end ( " + report_heuristics + " ) for " + _theAction);
    }
    if (_theAction == null) {
        throw new NoTransaction();
    }
    try {
        _theAction.commit(report_heuristics);
        _theStatus = Status.StatusCommitted;
    } catch (Unavailable e) {
        _theStatus = Status.StatusNoTransaction;
        throw new NoTransaction();
    } catch (HeuristicMixed e) {
        _theStatus = getStatus();
        throw e;
    } catch (HeuristicHazard e) {
        _theStatus = getStatus();
        throw e;
    } catch (TRANSACTION_ROLLEDBACK e) {
        _theStatus = Status.StatusRolledBack;
        throw e;
    } catch (SystemException e) {
        _theStatus = getStatus();
        throw e;
    } finally {
        // now remove it from the reaper
        TransactionReaper.transactionReaper().remove(_theAction);
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) SystemException(org.omg.CORBA.SystemException) HeuristicMixed(org.omg.CosTransactions.HeuristicMixed) TRANSACTION_ROLLEDBACK(org.omg.CORBA.TRANSACTION_ROLLEDBACK) HeuristicHazard(org.omg.CosTransactions.HeuristicHazard) Unavailable(org.omg.CosTransactions.Unavailable)

Aggregations

NoTransaction (org.omg.CosTransactions.NoTransaction)32 Current (org.omg.CosTransactions.Current)17 SystemException (org.omg.CORBA.SystemException)9 TRANSACTION_ROLLEDBACK (org.omg.CORBA.TRANSACTION_ROLLEDBACK)5 CosTransactions.otid_t (org.omg.CosTransactions.otid_t)5 CurrentImple (com.arjuna.ats.internal.jts.orbspecific.CurrentImple)4 INVALID_TRANSACTION (org.omg.CORBA.INVALID_TRANSACTION)4 HeuristicHazard (org.omg.CosTransactions.HeuristicHazard)4 HeuristicMixed (org.omg.CosTransactions.HeuristicMixed)4 Inactive (org.omg.CosTransactions.Inactive)4 BAD_PARAM (org.omg.CORBA.BAD_PARAM)3 WrongTransaction (org.omg.CORBA.WrongTransaction)3 Unavailable (org.omg.CosTransactions.Unavailable)3 GlobalTransactionInfo (com.arjuna.ArjunaOTS.GlobalTransactionInfo)2 Uid (com.arjuna.ats.arjuna.common.Uid)2 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)2 ControlWrapper (com.arjuna.ats.internal.jts.ControlWrapper)2 TransactionFactoryImple (com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple)2 Test (org.junit.Test)2 UserException (org.omg.CORBA.UserException)2