Search in sources :

Example 6 with JavaEETransactionManagerSimplified

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

the class JavaEETransactionManagerJTSDelegate method commitDistributedTransaction.

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

Example 7 with JavaEETransactionManagerSimplified

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

the class JavaEETransactionManagerJTSDelegate method enlistDistributedNonXAResource.

public boolean enlistDistributedNonXAResource(Transaction tx, TransactionalResource h) throws RollbackException, IllegalStateException, SystemException {
    if (useLAO()) {
        if (((JavaEETransactionManagerSimplified) javaEETM).resourceEnlistable(h)) {
            XAResource res = h.getXAResource();
            boolean result = tx.enlistResource(res);
            if (!h.isEnlisted())
                h.enlistedInTransaction(tx);
            return result;
        } else {
            return true;
        }
    } else {
        throw new IllegalStateException(sm.getString("enterprise_distributedtx.nonxa_usein_jts"));
    }
}
Also used : OracleXAResource(com.sun.enterprise.transaction.jts.recovery.OracleXAResource) SybaseXAResource(com.sun.enterprise.transaction.jts.recovery.SybaseXAResource) 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