Example usage for org.springframework.transaction.reactive GenericReactiveTransaction getSuspendedResources

List of usage examples for org.springframework.transaction.reactive GenericReactiveTransaction getSuspendedResources

Introduction

In this page you can find the example usage for org.springframework.transaction.reactive GenericReactiveTransaction getSuspendedResources.

Prototype

@Nullable
public Object getSuspendedResources() 

Source Link

Document

Return the holder for resources that have been suspended for this transaction, if any.

Usage

From source file:org.springframework.transaction.reactive.AbstractReactiveTransactionManager.java

/**
 * Clean up after completion, clearing synchronization if necessary,
 * and invoking doCleanupAfterCompletion.
 * @param synchronizationManager the synchronization manager bound to the current transaction
 * @param status object representing the transaction
 * @see #doCleanupAfterCompletion//from   w  w  w. ja  v a  2 s  .c om
 */
private Mono<Void> cleanupAfterCompletion(TransactionSynchronizationManager synchronizationManager,
        GenericReactiveTransaction status) {

    return Mono.defer(() -> {
        status.setCompleted();
        if (status.isNewSynchronization()) {
            synchronizationManager.clear();
        }
        Mono<Void> cleanup = Mono.empty();
        if (status.isNewTransaction()) {
            cleanup = doCleanupAfterCompletion(synchronizationManager, status.getTransaction());
        }
        if (status.getSuspendedResources() != null) {
            if (status.isDebug()) {
                logger.debug("Resuming suspended transaction after completion of inner transaction");
            }
            Object transaction = (status.hasTransaction() ? status.getTransaction() : null);
            return cleanup.then(resume(synchronizationManager, transaction,
                    (SuspendedResourcesHolder) status.getSuspendedResources()));
        }
        return cleanup;
    });
}