From ffbecf1427019c3d407342df2fa5dc949da35d15 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 3 May 2019 18:24:30 +0200 Subject: [PATCH] Fix Checkstyle violation --- .../reactive/TransactionalOperatorImpl.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionalOperatorImpl.java b/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionalOperatorImpl.java index ec8e22f11b..db608a86db 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionalOperatorImpl.java +++ b/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionalOperatorImpl.java @@ -75,15 +75,13 @@ final class TransactionalOperatorImpl implements TransactionalOperator { public Flux execute(TransactionCallback action) throws TransactionException { return TransactionContextManager.currentContext().flatMapMany(context -> { Mono status = this.transactionManager.getReactiveTransaction(this.transactionDefinition); - return status.flatMapMany(it -> { - // This is an around advice: Invoke the next interceptor in the chain. - // This will normally result in a target object being invoked. - // Need re-wrapping of ReactiveTransaction until we get hold of the exception - // through usingWhen. - return Flux.usingWhen(Mono.just(it), action::doInTransaction, - this.transactionManager::commit, s -> Mono.empty()) - .onErrorResume(ex -> rollbackOnException(it, ex).then(Mono.error(ex))); - }); + // This is an around advice: Invoke the next interceptor in the chain. + // This will normally result in a target object being invoked. + // Need re-wrapping of ReactiveTransaction until we get hold of the exception + // through usingWhen. + return status.flatMapMany(it -> Flux.usingWhen(Mono.just(it), action::doInTransaction, + this.transactionManager::commit, s -> Mono.empty()) + .onErrorResume(ex -> rollbackOnException(it, ex).then(Mono.error(ex)))); }) .subscriberContext(TransactionContextManager.getOrCreateContext()) .subscriberContext(TransactionContextManager.getOrCreateContextHolder());