Search in sources :

Example 1 with TransactionSuspensionNotSupportedException

use of cn.taketoday.transaction.TransactionSuspensionNotSupportedException in project today-infrastructure by TAKETODAY.

the class JtaTransactionManager method doJtaResume.

/**
 * Perform a JTA resume on the JTA TransactionManager.
 * <p>Can be overridden in subclasses, for specific JTA implementations.
 *
 * @param txObject the JtaTransactionObject containing the UserTransaction
 * @param suspendedTransaction the suspended JTA Transaction object
 * @throws InvalidTransactionException if thrown by JTA methods
 * @throws SystemException if thrown by JTA methods
 * @see #getTransactionManager()
 * @see TransactionManager#resume(Transaction)
 */
protected void doJtaResume(@Nullable JtaTransactionObject txObject, Object suspendedTransaction) throws InvalidTransactionException, SystemException {
    TransactionManager transactionManager = getTransactionManager();
    if (transactionManager == null) {
        throw new TransactionSuspensionNotSupportedException("JtaTransactionManager needs a JTA TransactionManager for suspending a transaction: " + "specify the 'transactionManager' or 'transactionManagerName' property");
    }
    transactionManager.resume((Transaction) suspendedTransaction);
}
Also used : TransactionManager(jakarta.transaction.TransactionManager) PlatformTransactionManager(cn.taketoday.transaction.PlatformTransactionManager) AbstractPlatformTransactionManager(cn.taketoday.transaction.support.AbstractPlatformTransactionManager) TransactionSuspensionNotSupportedException(cn.taketoday.transaction.TransactionSuspensionNotSupportedException)

Example 2 with TransactionSuspensionNotSupportedException

use of cn.taketoday.transaction.TransactionSuspensionNotSupportedException in project today-framework by TAKETODAY.

the class JtaTransactionManager method doJtaResume.

/**
 * Perform a JTA resume on the JTA TransactionManager.
 * <p>Can be overridden in subclasses, for specific JTA implementations.
 *
 * @param txObject the JtaTransactionObject containing the UserTransaction
 * @param suspendedTransaction the suspended JTA Transaction object
 * @throws InvalidTransactionException if thrown by JTA methods
 * @throws SystemException if thrown by JTA methods
 * @see #getTransactionManager()
 * @see TransactionManager#resume(Transaction)
 */
protected void doJtaResume(@Nullable JtaTransactionObject txObject, Object suspendedTransaction) throws InvalidTransactionException, SystemException {
    TransactionManager transactionManager = getTransactionManager();
    if (transactionManager == null) {
        throw new TransactionSuspensionNotSupportedException("JtaTransactionManager needs a JTA TransactionManager for suspending a transaction: " + "specify the 'transactionManager' or 'transactionManagerName' property");
    }
    transactionManager.resume((Transaction) suspendedTransaction);
}
Also used : TransactionManager(jakarta.transaction.TransactionManager) PlatformTransactionManager(cn.taketoday.transaction.PlatformTransactionManager) AbstractPlatformTransactionManager(cn.taketoday.transaction.support.AbstractPlatformTransactionManager) TransactionSuspensionNotSupportedException(cn.taketoday.transaction.TransactionSuspensionNotSupportedException)

Aggregations

PlatformTransactionManager (cn.taketoday.transaction.PlatformTransactionManager)2 TransactionSuspensionNotSupportedException (cn.taketoday.transaction.TransactionSuspensionNotSupportedException)2 AbstractPlatformTransactionManager (cn.taketoday.transaction.support.AbstractPlatformTransactionManager)2 TransactionManager (jakarta.transaction.TransactionManager)2