Skip to content

Commit

Permalink
Close ZK before canceling future with exception (#6228) (#6399)
Browse files Browse the repository at this point in the history
Fixes #6228

(cherry picked from commit e6a631d)
  • Loading branch information
pawellozinski authored and tuteng committed Apr 5, 2020
1 parent 1061ac8 commit 211d7f0
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public CompletableFuture<ZooKeeper> create(String serverList, SessionType sessio
.build();

if (zk.getState() == States.CONNECTEDREADONLY && sessionType != SessionType.AllowReadOnly) {
zk.close();
future.completeExceptionally(new IllegalStateException("Cannot use a read-only session"));
}

Expand Down

0 comments on commit 211d7f0

Please sign in to comment.