Upgrade Reactor to Dysprosium RC1
Closes: gh-23579
This commit is contained in:
@@ -854,15 +854,22 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
createTransactionIfNecessary(tm, txAttr, joinpointIdentification).flatMap(it -> {
|
||||
try {
|
||||
// Need re-wrapping until we get hold of the exception through usingWhen.
|
||||
return Mono.<Object, ReactiveTransactionInfo>usingWhen(Mono.just(it), txInfo -> {
|
||||
try {
|
||||
return (Mono<?>) invocation.proceedWithInvocation();
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
return Mono.error(ex);
|
||||
}
|
||||
}, this::commitTransactionAfterReturning, txInfo -> Mono.empty())
|
||||
.onErrorResume(ex -> completeTransactionAfterThrowing(it, ex).then(Mono.error(ex)));
|
||||
return Mono
|
||||
.<Object, ReactiveTransactionInfo>usingWhen(
|
||||
Mono.just(it),
|
||||
txInfo -> {
|
||||
try {
|
||||
return (Mono<?>) invocation.proceedWithInvocation();
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
return Mono.error(ex);
|
||||
}
|
||||
},
|
||||
this::commitTransactionAfterReturning,
|
||||
(txInfo, err) -> Mono.empty(),
|
||||
this::commitTransactionAfterReturning)
|
||||
.onErrorResume(ex ->
|
||||
completeTransactionAfterThrowing(it, ex).then(Mono.error(ex)));
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
// target invocation exception
|
||||
@@ -877,15 +884,22 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
createTransactionIfNecessary(tm, txAttr, joinpointIdentification).flatMapMany(it -> {
|
||||
try {
|
||||
// Need re-wrapping until we get hold of the exception through usingWhen.
|
||||
return Flux.usingWhen(Mono.just(it), txInfo -> {
|
||||
try {
|
||||
return this.adapter.toPublisher(invocation.proceedWithInvocation());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
return Mono.error(ex);
|
||||
}
|
||||
}, this::commitTransactionAfterReturning, txInfo -> Mono.empty())
|
||||
.onErrorResume(ex -> completeTransactionAfterThrowing(it, ex).then(Mono.error(ex)));
|
||||
return Flux
|
||||
.usingWhen(
|
||||
Mono.just(it),
|
||||
txInfo -> {
|
||||
try {
|
||||
return this.adapter.toPublisher(invocation.proceedWithInvocation());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
return Mono.error(ex);
|
||||
}
|
||||
},
|
||||
this::commitTransactionAfterReturning,
|
||||
(txInfo, ex) -> Mono.empty(),
|
||||
this::commitTransactionAfterReturning)
|
||||
.onErrorResume(ex ->
|
||||
completeTransactionAfterThrowing(it, ex).then(Mono.error(ex)));
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
// target invocation exception
|
||||
|
||||
@@ -80,9 +80,15 @@ final class TransactionalOperatorImpl implements TransactionalOperator {
|
||||
// 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))));
|
||||
return status.flatMapMany(it -> Flux
|
||||
.usingWhen(
|
||||
Mono.just(it),
|
||||
action::doInTransaction,
|
||||
this.transactionManager::commit,
|
||||
(tx, ex) -> Mono.empty(),
|
||||
this.transactionManager::commit)
|
||||
.onErrorResume(ex ->
|
||||
rollbackOnException(it, ex).then(Mono.error(ex))));
|
||||
})
|
||||
.subscriberContext(TransactionContextManager.getOrCreateContext())
|
||||
.subscriberContext(TransactionContextManager.getOrCreateContextHolder());
|
||||
|
||||
Reference in New Issue
Block a user