Search in sources :

Example 1 with ExtendedJBossXATerminator

use of org.jboss.tm.ExtendedJBossXATerminator in project narayana by jbosstm.

the class ServerImpl method locateOrImportTransactionThenResumeIt.

@Override
public Xid locateOrImportTransactionThenResumeIt(int remainingTimeout, Xid toResume) throws XAException, IllegalStateException, SystemException, IOException {
    JBossXATerminator xaTerminator = transactionManagerService.getJbossXATerminator();
    if (!ExtendedJBossXATerminator.class.isInstance(xaTerminator)) {
        System.out.printf("ExtendedJBossXATerminator: FAIL not an instance");
        return null;
    }
    ExtendedJBossXATerminator extendedJBossXATerminator = (ExtendedJBossXATerminator) xaTerminator;
    boolean subordinateCreated = false;
    Transaction transaction = extendedJBossXATerminator.getTransaction(toResume);
    if (transaction == null) {
        TransactionImportResult transactionImportResult = extendedJBossXATerminator.importTransaction(toResume, remainingTimeout);
        subordinateCreated = transactionImportResult.isNewImportedTransaction();
        transaction = transactionImportResult.getTransaction();
    }
    transactionManagerService.getTransactionManager().resume(transaction);
    return subordinateCreated ? ((com.arjuna.ats.jta.transaction.Transaction) transaction).getTxId() : null;
}
Also used : ExtendedJBossXATerminator(org.jboss.tm.ExtendedJBossXATerminator) JBossXATerminator(org.jboss.tm.JBossXATerminator) TransactionImportResult(org.jboss.tm.TransactionImportResult) Transaction(javax.transaction.Transaction) ExtendedJBossXATerminator(org.jboss.tm.ExtendedJBossXATerminator)

Aggregations

Transaction (javax.transaction.Transaction)1 ExtendedJBossXATerminator (org.jboss.tm.ExtendedJBossXATerminator)1 JBossXATerminator (org.jboss.tm.JBossXATerminator)1 TransactionImportResult (org.jboss.tm.TransactionImportResult)1