Search in sources :

Example 1 with DelegateTransaction

use of org.mule.runtime.core.internal.processor.DelegateTransaction in project mule by mulesoft.

the class DelegateTransactionFactory method beginTransaction.

@Override
public Transaction beginTransaction(MuleContext muleContext) throws TransactionException {
    DelegateTransaction delegateTransaction = new DelegateTransaction(muleContext);
    delegateTransaction.begin();
    return delegateTransaction;
}
Also used : DelegateTransaction(org.mule.runtime.core.internal.processor.DelegateTransaction)

Example 2 with DelegateTransaction

use of org.mule.runtime.core.internal.processor.DelegateTransaction in project mule by mulesoft.

the class TransactionCoordination method bindTransaction.

public void bindTransaction(final Transaction transaction) throws TransactionException {
    Transaction oldTx = transactions.get();
    // special handling for transaction collection
    if (oldTx != null && !(oldTx instanceof DelegateTransaction)) {
        throw new IllegalTransactionStateException(CoreMessages.transactionAlreadyBound());
    }
    if (oldTx != null && oldTx instanceof DelegateTransaction) {
        DelegateTransaction delegateTransaction = (DelegateTransaction) oldTx;
        if (!delegateTransaction.supportsInnerTransaction(transaction)) {
            throw new IllegalTransactionStateException(CoreMessages.transactionAlreadyBound());
        }
        return;
    }
    transactions.set(transaction);
    logTransactionBound(transaction);
}
Also used : DelegateTransaction(org.mule.runtime.core.internal.processor.DelegateTransaction) IllegalTransactionStateException(org.mule.runtime.core.privileged.transaction.xa.IllegalTransactionStateException) DelegateTransaction(org.mule.runtime.core.internal.processor.DelegateTransaction)

Aggregations

DelegateTransaction (org.mule.runtime.core.internal.processor.DelegateTransaction)2 IllegalTransactionStateException (org.mule.runtime.core.privileged.transaction.xa.IllegalTransactionStateException)1