Search in sources :

Example 1 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 2 with CurrentImple

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

the class ContextThreadSetup 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 3 with CurrentImple

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

the class TopLevelTransaction method resumeTransaction.

private final void resumeTransaction() {
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("TopLevelTransaction::resumeTransaction for " + _originalTransaction);
    }
    try {
        if (_originalTransaction != null) {
            CurrentImple current = OTSImpleManager.current();
            current.resume(_originalTransaction);
            _originalTransaction = null;
        }
    } catch (Exception e) {
    }
}
Also used : CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple) SystemException(org.omg.CORBA.SystemException)

Example 4 with CurrentImple

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

the class TopLevelTransaction method begin.

/**
 * If nested top-level transaction, save current context for resumption
 * later.
 */
public synchronized void begin() throws SystemException, SubtransactionsUnavailable {
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("TopLevelTransaction::begin ()");
    }
    if (_originalTransaction != null) {
        throw new INVALID_TRANSACTION();
    }
    CurrentImple current = OTSImpleManager.current();
    _originalTransaction = current.suspend();
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("TopLevelTransaction::begin - suspend transaction " + _originalTransaction);
    }
    super.begin();
}
Also used : INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple)

Example 5 with CurrentImple

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

the class ExplicitInterposition method registerTransaction.

private final synchronized void registerTransaction(PropagationContext ctx) throws InterpositionFailed, SystemException {
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("ExplicitInterposition::registerTransaction ( PropagationContext ctx )");
    }
    if (_inUse) {
        jtsLogger.i18NLogger.warn_excalledagain("ExplicitInterposition.registerTransaction");
        throw new InterpositionFailed();
    }
    if (// invalid
    (ctx == null) || (ctx.current.coord == null))
        throw new INVALID_TRANSACTION(ExceptionCodes.INVALID_ACTION, CompletionStatus.COMPLETED_NO);
    _inUse = true;
    TransactionFactoryImple _localFactory = OTSImpleManager.factory();
    try {
        ControlImple cont = _localFactory.recreateLocal(ctx);
        CurrentImple current = OTSImpleManager.current();
        if (_remember) {
            try {
                _oldControl = current.suspendWrapper();
            } catch (Exception e) {
                throw new InterpositionFailed();
            }
        }
        current.resumeImple(cont);
        // current.resume(cont.getControl());
        cont = null;
    } catch (InterpositionFailed ex) {
        throw ex;
    } catch (Exception e) {
        jtsLogger.i18NLogger.warn_eicaughtexception("ExplicitInterposition.registerTransaction(PropagationContext)", e);
        throw new InterpositionFailed();
    }
}
Also used : InterpositionFailed(com.arjuna.ArjunaOTS.InterpositionFailed) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) TransactionFactoryImple(com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple) CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) SystemException(org.omg.CORBA.SystemException)

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