Search in sources :

Example 26 with CurrentImple

use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.

the class InterpositionThreadSetup method setup.

public void setup() {
    /*
	 * Simply getting (or trying to get) the current tx control
	 * will ensure that this thread is initialised properly. We
	 * have to do this because in a POA implementation the receiving
	 * thread may not be the same one which does the work, so we
	 * cannot do thread association at the interceptor level. We must
	 * do it when the invoked method actually gets called.
	 */
    CurrentImple curr = OTSImpleManager.current();
    /*
	 * Probably separate the underlying work out so that we can
	 * call that directly. No real harm at present since the hard
	 * work represents most of the overhead and has to be done
	 * anyway.
	 */
    curr.contextManager().associate();
}
Also used : CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple)

Example 27 with CurrentImple

use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.

the class OTSThread method run.

public void run() {
    if (_currentControl != null) {
        try {
            CurrentImple current = OTSImpleManager.current();
            if (current != null) {
                current.resume(_currentControl);
                current = null;
            }
        } catch (Exception e) {
            jtsLogger.i18NLogger.warn_thread_resumefailed("OTSThread.run", e);
            throw new FatalError("OTSThread.run - " + jtsLogger.i18NLogger.get_thread_resumefailederror(), e);
        }
        _currentControl = null;
    }
}
Also used : FatalError(com.arjuna.ats.arjuna.exceptions.FatalError) CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple)

Example 28 with CurrentImple

use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.

the class tx method tx_rollback.

/**
 * This needs to implement checked transactions such that only the
 * transaction initiator (thread) can terminate it.
 */
public static final synchronized int tx_rollback() {
    int toReturn = tx.TX_OK;
    CurrentImple current = OTSImpleManager.current();
    try {
        current.rollback();
    } catch (NoTransaction e1) {
        toReturn = tx.TX_NO_BEGIN;
    } catch (Exception e2) {
        toReturn = tx.TX_FAIL;
    }
    return toReturn;
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple)

Example 29 with CurrentImple

use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.

the class tx method tx_set_transaction_timeout.

public static final synchronized int tx_set_transaction_timeout(int timeout) {
    int toReturn = tx.TX_OK;
    CurrentImple current = OTSImpleManager.current();
    try {
        current.set_timeout(timeout);
    } catch (Exception e) {
        toReturn = tx.TX_FAIL;
    }
    return toReturn;
}
Also used : CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple)

Example 30 with CurrentImple

use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.

the class tx method tx_begin.

public static final synchronized int tx_begin() {
    int toReturn = tx.TX_OK;
    CurrentImple current = OTSImpleManager.current();
    if (!__tx_allow_nesting) {
        try {
            Control control = current.get_control();
            if (control != null) {
                /*
		     * Have a transaction already, and not allowed to
		     * create nested transactions!
		     */
                toReturn = tx.TX_PROTOCOL_ERROR;
                control = null;
            }
        } catch (Exception e) {
            // something went wrong!
            toReturn = tx.TX_FAIL;
        }
    }
    if (toReturn == tx.TX_OK) {
        try {
            current.begin();
        } catch (Exception e) {
            toReturn = tx.TX_FAIL;
        }
    }
    return toReturn;
}
Also used : Control(org.omg.CosTransactions.Control) CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple)

Aggregations

CurrentImple (com.arjuna.ats.internal.jts.orbspecific.CurrentImple)47 Control (org.omg.CosTransactions.Control)14 SystemException (org.omg.CORBA.SystemException)12 ORB (com.arjuna.orbportability.ORB)9 RootOA (com.arjuna.orbportability.RootOA)9 IOException (java.io.IOException)7 Lock (com.arjuna.ats.txoj.Lock)6 ServerORB (com.hp.mwtests.ts.jts.utils.ServerORB)6 Coordinator (org.omg.CosTransactions.Coordinator)6 Services (com.arjuna.orbportability.Services)5 TRANSACTION_ROLLEDBACK (org.omg.CORBA.TRANSACTION_ROLLEDBACK)5 ExplicitInterposition (com.arjuna.ats.jts.ExplicitInterposition)4 Test (org.junit.Test)4 TransactionFactoryImple (com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple)3 TestException (com.hp.mwtests.ts.jts.exceptions.TestException)3 INVALID_TRANSACTION (org.omg.CORBA.INVALID_TRANSACTION)3 NoTransaction (org.omg.CosTransactions.NoTransaction)3 InterpositionFailed (com.arjuna.ArjunaOTS.InterpositionFailed)2 FatalError (com.arjuna.ats.arjuna.exceptions.FatalError)2 ControlWrapper (com.arjuna.ats.internal.jts.ControlWrapper)2