Example usage for org.springframework.transaction.event TransactionPhase AFTER_ROLLBACK

List of usage examples for org.springframework.transaction.event TransactionPhase AFTER_ROLLBACK

Introduction

In this page you can find the example usage for org.springframework.transaction.event TransactionPhase AFTER_ROLLBACK.

Prototype

TransactionPhase AFTER_ROLLBACK

To view the source code for org.springframework.transaction.event TransactionPhase AFTER_ROLLBACK.

Click Source Link

Document

Fire the event if the transaction has rolled back.

Usage

From source file:org.springframework.transaction.event.ApplicationListenerMethodTransactionalAdapter.java

@Override
public void onApplicationEvent(ApplicationEvent event) {
    if (TransactionSynchronizationManager.isSynchronizationActive()) {
        TransactionSynchronization transactionSynchronization = createTransactionSynchronization(event);
        TransactionSynchronizationManager.registerSynchronization(transactionSynchronization);
    } else if (this.annotation.fallbackExecution()) {
        if (this.annotation.phase() == TransactionPhase.AFTER_ROLLBACK) {
            logger.warn("Processing '" + event + "' as a fallback execution on AFTER_ROLLBACK phase.");
        }/*from   w ww .  j  a  va2  s.  c  o m*/
        processEvent(event);
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("No transaction is running, skipping '" + event + "' for '" + this + "'");
        }
    }
}