We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 48becf7 commit 8a73a28Copy full SHA for 8a73a28
driver/src/main/java/org/neo4j/driver/internal/bolt/pooledimpl/PooledBoltConnection.java
@@ -269,9 +269,17 @@ public CompletionStage<Void> forceClose(String reason) {
269
270
@Override
271
public CompletionStage<Void> close() {
272
- if (closeFuture == null) {
273
- closeFuture = new CompletableFuture<>();
+ CompletableFuture<Void> closeFuture;
+ var close = false;
274
+ synchronized (this) {
275
+ if (this.closeFuture == null) {
276
+ this.closeFuture = new CompletableFuture<>();
277
+ close = true;
278
+ }
279
+ closeFuture = this.closeFuture;
280
281
282
+ if (close) {
283
if (delegate.state() == BoltConnectionState.CLOSED) {
284
purgeRunnable.run();
285
closeFuture.complete(null);
0 commit comments