Example usage for org.springframework.transaction.support TransactionSynchronization afterCompletion

List of usage examples for org.springframework.transaction.support TransactionSynchronization afterCompletion

Introduction

In this page you can find the example usage for org.springframework.transaction.support TransactionSynchronization afterCompletion.

Prototype

default void afterCompletion(int status) 

Source Link

Document

Invoked after transaction commit/rollback.

Usage

From source file:org.springframework.transaction.support.TransactionSynchronizationUtils.java

/**
 * Actually invoke the {@code afterCompletion} methods of the
 * given Spring TransactionSynchronization objects.
 * @param synchronizations List of TransactionSynchronization objects
 * @param completionStatus the completion status according to the
 * constants in the TransactionSynchronization interface
 * @see TransactionSynchronization#afterCompletion(int)
 * @see TransactionSynchronization#STATUS_COMMITTED
 * @see TransactionSynchronization#STATUS_ROLLED_BACK
 * @see TransactionSynchronization#STATUS_UNKNOWN
 *//*from   www.  j  a va  2 s  .c om*/
public static void invokeAfterCompletion(@Nullable List<TransactionSynchronization> synchronizations,
        int completionStatus) {

    if (synchronizations != null) {
        for (TransactionSynchronization synchronization : synchronizations) {
            try {
                synchronization.afterCompletion(completionStatus);
            } catch (Throwable tsex) {
                logger.error("TransactionSynchronization.afterCompletion threw exception", tsex);
            }
        }
    }
}