[jOOQ/jOOQ#12977] Correctly sequence close() call and completion delegation
This commit is contained in:
parent
00fcb99d83
commit
fe9e8854ea
@ -583,16 +583,18 @@ final class R2DBC {
|
||||
|
||||
delegate().connection.updateAndGet(c -> {
|
||||
|
||||
// [#12977] Correctly sequence the delegation to run after close completion
|
||||
Runnable onComplete = cancelled ? () -> {} : () -> subscriber.onComplete();
|
||||
|
||||
// close() calls on already closed resources have no effect, so
|
||||
// the side-effect is OK with the AtomicReference contract
|
||||
if (c != null)
|
||||
c.close().subscribe(subscriber(s -> s.request(Long.MAX_VALUE), t -> {}, t -> {}, () -> {}));
|
||||
c.close().subscribe(subscriber(s -> s.request(Long.MAX_VALUE), t -> {}, t -> {}, onComplete));
|
||||
else
|
||||
onComplete.run();
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
if (!cancelled)
|
||||
subscriber.onComplete();
|
||||
}
|
||||
|
||||
abstract ConnectionSubscriber<T> delegate();
|
||||
|
||||
5
pom.xml
5
pom.xml
@ -457,6 +457,11 @@
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-r2dbc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user