parent
f26866e4d4
commit
57d9b92b94
|
|
@ -32,7 +32,7 @@ configure(allprojects) { project ->
|
||||||
imports {
|
imports {
|
||||||
mavenBom "com.fasterxml.jackson:jackson-bom:2.9.9"
|
mavenBom "com.fasterxml.jackson:jackson-bom:2.9.9"
|
||||||
mavenBom "io.netty:netty-bom:4.1.39.Final"
|
mavenBom "io.netty:netty-bom:4.1.39.Final"
|
||||||
mavenBom "io.projectreactor:reactor-bom:Dysprosium-M3"
|
mavenBom "io.projectreactor:reactor-bom:Dysprosium-RC1"
|
||||||
mavenBom "org.eclipse.jetty:jetty-bom:9.4.20.v20190813"
|
mavenBom "org.eclipse.jetty:jetty-bom:9.4.20.v20190813"
|
||||||
mavenBom "org.jetbrains.kotlin:kotlin-bom:1.3.50"
|
mavenBom "org.jetbrains.kotlin:kotlin-bom:1.3.50"
|
||||||
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.0"
|
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.0"
|
||||||
|
|
|
||||||
|
|
@ -854,15 +854,22 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||||
createTransactionIfNecessary(tm, txAttr, joinpointIdentification).flatMap(it -> {
|
createTransactionIfNecessary(tm, txAttr, joinpointIdentification).flatMap(it -> {
|
||||||
try {
|
try {
|
||||||
// Need re-wrapping until we get hold of the exception through usingWhen.
|
// Need re-wrapping until we get hold of the exception through usingWhen.
|
||||||
return Mono.<Object, ReactiveTransactionInfo>usingWhen(Mono.just(it), txInfo -> {
|
return Mono
|
||||||
try {
|
.<Object, ReactiveTransactionInfo>usingWhen(
|
||||||
return (Mono<?>) invocation.proceedWithInvocation();
|
Mono.just(it),
|
||||||
}
|
txInfo -> {
|
||||||
catch (Throwable ex) {
|
try {
|
||||||
return Mono.error(ex);
|
return (Mono<?>) invocation.proceedWithInvocation();
|
||||||
}
|
}
|
||||||
}, this::commitTransactionAfterReturning, txInfo -> Mono.empty())
|
catch (Throwable ex) {
|
||||||
.onErrorResume(ex -> completeTransactionAfterThrowing(it, ex).then(Mono.error(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) {
|
catch (Throwable ex) {
|
||||||
// target invocation exception
|
// target invocation exception
|
||||||
|
|
@ -877,15 +884,22 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||||
createTransactionIfNecessary(tm, txAttr, joinpointIdentification).flatMapMany(it -> {
|
createTransactionIfNecessary(tm, txAttr, joinpointIdentification).flatMapMany(it -> {
|
||||||
try {
|
try {
|
||||||
// Need re-wrapping until we get hold of the exception through usingWhen.
|
// Need re-wrapping until we get hold of the exception through usingWhen.
|
||||||
return Flux.usingWhen(Mono.just(it), txInfo -> {
|
return Flux
|
||||||
try {
|
.usingWhen(
|
||||||
return this.adapter.toPublisher(invocation.proceedWithInvocation());
|
Mono.just(it),
|
||||||
}
|
txInfo -> {
|
||||||
catch (Throwable ex) {
|
try {
|
||||||
return Mono.error(ex);
|
return this.adapter.toPublisher(invocation.proceedWithInvocation());
|
||||||
}
|
}
|
||||||
}, this::commitTransactionAfterReturning, txInfo -> Mono.empty())
|
catch (Throwable ex) {
|
||||||
.onErrorResume(ex -> completeTransactionAfterThrowing(it, ex).then(Mono.error(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) {
|
catch (Throwable ex) {
|
||||||
// target invocation exception
|
// target invocation exception
|
||||||
|
|
|
||||||
|
|
@ -80,9 +80,15 @@ final class TransactionalOperatorImpl implements TransactionalOperator {
|
||||||
// This will normally result in a target object being invoked.
|
// This will normally result in a target object being invoked.
|
||||||
// Need re-wrapping of ReactiveTransaction until we get hold of the exception
|
// Need re-wrapping of ReactiveTransaction until we get hold of the exception
|
||||||
// through usingWhen.
|
// through usingWhen.
|
||||||
return status.flatMapMany(it -> Flux.usingWhen(Mono.just(it), action::doInTransaction,
|
return status.flatMapMany(it -> Flux
|
||||||
this.transactionManager::commit, s -> Mono.empty())
|
.usingWhen(
|
||||||
.onErrorResume(ex -> rollbackOnException(it, ex).then(Mono.error(ex))));
|
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.getOrCreateContext())
|
||||||
.subscriberContext(TransactionContextManager.getOrCreateContextHolder());
|
.subscriberContext(TransactionContextManager.getOrCreateContextHolder());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue