Search in sources :

Example 1 with JavaEETransactionManagerSimplified

use of com.sun.enterprise.transaction.JavaEETransactionManagerSimplified in project Payara by payara.

the class AppTest method setUp.

public void setUp() {
    try {
        t = new JavaEETransactionManagerSimplified();
        ((JavaEETransactionManager) t).setDelegate(new JavaEETransactionManagerXADelegate());
    } catch (Exception ex) {
        ex.printStackTrace();
        assert (false);
    }
}
Also used : JavaEETransactionManagerSimplified(com.sun.enterprise.transaction.JavaEETransactionManagerSimplified) JavaEETransactionManager(com.sun.enterprise.transaction.api.JavaEETransactionManager)

Example 2 with JavaEETransactionManagerSimplified

use of com.sun.enterprise.transaction.JavaEETransactionManagerSimplified in project Payara by payara.

the class AppTest method setUp.

public void setUp() {
    try {
        t = new JavaEETransactionManagerSimplified();
        JavaEETransactionManagerDelegate d = new JavaEETransactionManagerJTSDelegate();
        t.setDelegate(d);
        d.setTransactionManager(t);
    } catch (Exception ex) {
        ex.printStackTrace();
        assert (false);
    }
}
Also used : JavaEETransactionManagerDelegate(com.sun.enterprise.transaction.spi.JavaEETransactionManagerDelegate) JavaEETransactionManagerSimplified(com.sun.enterprise.transaction.JavaEETransactionManagerSimplified) TimeoutException(java.util.concurrent.TimeoutException)

Example 3 with JavaEETransactionManagerSimplified

use of com.sun.enterprise.transaction.JavaEETransactionManagerSimplified in project Payara by payara.

the class JavaEETransactionManagerJTSDelegate method rollbackDistributedTransaction.

/**
 * An XA transaction rollback
 */
public void rollbackDistributedTransaction() throws IllegalStateException, SecurityException, SystemException {
    if (_logger.isLoggable(Level.FINE))
        _logger.log(Level.FINE, "TM: rollback");
    validateTransactionManager();
    TransactionManager tm = tmLocal.get();
    // monitoring object
    Object obj = tm.getTransaction();
    JavaEETransactionManagerSimplified javaEETMS = (JavaEETransactionManagerSimplified) javaEETM;
    try {
        if (javaEETMS.isInvocationStackEmpty()) {
            tm.rollback();
        } else {
            try {
                javaEETMS.setTransactionCompeting(true);
                tm.rollback();
            /**
             *                } catch (InvocationException ex) {
             *                    assert false;
             */
            } finally {
                javaEETMS.setTransactionCompeting(false);
            }
        }
    } finally {
        javaEETMS.monitorTxCompleted(obj, false);
    }
}
Also used : JavaEETransactionManager(com.sun.enterprise.transaction.api.JavaEETransactionManager) JavaEETransactionManagerSimplified(com.sun.enterprise.transaction.JavaEETransactionManagerSimplified)

Example 4 with JavaEETransactionManagerSimplified

use of com.sun.enterprise.transaction.JavaEETransactionManagerSimplified in project Payara by payara.

the class JavaEETransactionManagerJTSDelegate method enlistLAOResource.

public boolean enlistLAOResource(Transaction tran, TransactionalResource h) throws RollbackException, IllegalStateException, SystemException {
    if (tran instanceof JavaEETransaction) {
        JavaEETransaction tx = (JavaEETransaction) tran;
        ((JavaEETransactionManagerSimplified) javaEETM).startJTSTx(tx);
        // Non XA to LAO
        if (useLAO()) {
            if (h != null && (tx.getLAOResource() == null)) {
                tx.setLAOResource(h);
                if (h.isTransactional()) {
                    XAResource res = h.getXAResource();
                    return tran.enlistResource(res);
                }
            }
        }
        return true;
    } else {
        // Should not be called
        return false;
    }
}
Also used : OracleXAResource(com.sun.enterprise.transaction.jts.recovery.OracleXAResource) SybaseXAResource(com.sun.enterprise.transaction.jts.recovery.SybaseXAResource) JavaEETransaction(com.sun.enterprise.transaction.api.JavaEETransaction) JavaEETransactionManagerSimplified(com.sun.enterprise.transaction.JavaEETransactionManagerSimplified)

Example 5 with JavaEETransactionManagerSimplified

use of com.sun.enterprise.transaction.JavaEETransactionManagerSimplified in project Payara by payara.

the class JavaEETransactionManagerJTSDelegate method beginJTS.

public void beginJTS(int timeout) throws NotSupportedException, SystemException {
    TransactionManagerImpl tm = (TransactionManagerImpl) tmLocal.get();
    tm.begin(timeout);
    ((JavaEETransactionManagerSimplified) javaEETM).monitorTxBegin(tm.getTransaction());
}
Also used : TransactionManagerImpl(com.sun.jts.jta.TransactionManagerImpl) JavaEETransactionManagerSimplified(com.sun.enterprise.transaction.JavaEETransactionManagerSimplified)

Aggregations

JavaEETransactionManagerSimplified (com.sun.enterprise.transaction.JavaEETransactionManagerSimplified)7 JavaEETransactionManager (com.sun.enterprise.transaction.api.JavaEETransactionManager)3 OracleXAResource (com.sun.enterprise.transaction.jts.recovery.OracleXAResource)2 SybaseXAResource (com.sun.enterprise.transaction.jts.recovery.SybaseXAResource)2 JavaEETransaction (com.sun.enterprise.transaction.api.JavaEETransaction)1 JavaEETransactionManagerDelegate (com.sun.enterprise.transaction.spi.JavaEETransactionManagerDelegate)1 TransactionManagerImpl (com.sun.jts.jta.TransactionManagerImpl)1 TimeoutException (java.util.concurrent.TimeoutException)1