Search in sources :

Example 1 with PersistentTestXAResource

use of org.jboss.as.test.integration.transactions.PersistentTestXAResource in project wildfly by wildfly.

the class TransactionalBean method intermittentCommitFailureTwoPhase.

@TransactionAttribute(TransactionAttributeType.MANDATORY)
public void intermittentCommitFailureTwoPhase() {
    try {
        Transaction txn = tm.getTransaction();
        log.debugf("Invocation to #intermittentCommitFailure with transaction: %s", txn);
        txn.enlistResource(new TestCommitFailureXAResource(transactionCheckerSingleton));
        txn.enlistResource(new PersistentTestXAResource(transactionCheckerSingleton));
    } catch (Exception e) {
        throw new IllegalStateException("Cannot enlist one of the XAResources " + TestCommitFailureXAResource.class.getSimpleName() + " or " + PersistentTestXAResource.class.getSimpleName() + " to the transaction", e);
    }
}
Also used : PersistentTestXAResource(org.jboss.as.test.integration.transactions.PersistentTestXAResource) Transaction(javax.transaction.Transaction) TransactionAttribute(javax.ejb.TransactionAttribute)

Example 2 with PersistentTestXAResource

use of org.jboss.as.test.integration.transactions.PersistentTestXAResource in project wildfly by wildfly.

the class TransactionalBean method enlistOnePersistentXAResource.

@TransactionAttribute(TransactionAttributeType.MANDATORY)
public void enlistOnePersistentXAResource() {
    try {
        log.debugf("Invocation to #enlistOnePersistentXAResource with transaction", tm.getTransaction());
        tm.getTransaction().enlistResource(new PersistentTestXAResource(transactionCheckerSingleton));
    } catch (Exception e) {
        throw new IllegalStateException("Cannot enlist single " + PersistentTestXAResource.class.getSimpleName() + " to transaction", e);
    }
}
Also used : PersistentTestXAResource(org.jboss.as.test.integration.transactions.PersistentTestXAResource) TransactionAttribute(javax.ejb.TransactionAttribute)

Example 3 with PersistentTestXAResource

use of org.jboss.as.test.integration.transactions.PersistentTestXAResource in project wildfly by wildfly.

the class TestXAResourceRecoveryHelper method postConstruct.

/**
 * Singleton lifecycle method.
 * Register the recovery module with the transaction manager.
 */
@PostConstruct
public void postConstruct() {
    log.debug("TestXAResourceRecoveryHelper starting");
    this.testXaResourceInstance = new TestXAResource(transactionCheckerSingleton);
    this.persistentTestXaResourceInstance = new PersistentTestXAResource(transactionCheckerSingleton);
    getRecoveryModule().addXAResourceRecoveryHelper(this);
}
Also used : PersistentTestXAResource(org.jboss.as.test.integration.transactions.PersistentTestXAResource) PersistentTestXAResource(org.jboss.as.test.integration.transactions.PersistentTestXAResource) TestXAResource(org.jboss.as.test.integration.transactions.TestXAResource) PostConstruct(javax.annotation.PostConstruct)

Aggregations

PersistentTestXAResource (org.jboss.as.test.integration.transactions.PersistentTestXAResource)3 TransactionAttribute (javax.ejb.TransactionAttribute)2 PostConstruct (javax.annotation.PostConstruct)1 Transaction (javax.transaction.Transaction)1 TestXAResource (org.jboss.as.test.integration.transactions.TestXAResource)1