Skip to content

Commit e2f2071

Browse files
pawellozinskijiazhai
authored andcommitted
Close ZK before canceling future with exception (apache#6228) (apache#6399)
Fixes apache#6228 (cherry picked from commit e6a631d)
1 parent b820bee commit e2f2071

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pulsar-zookeeper-utils/src/main/java/org/apache/pulsar/zookeeper/ZookeeperBkClientFactoryImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public CompletableFuture<ZooKeeper> create(String serverList, SessionType sessio
5555
.build();
5656

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

0 commit comments

Comments
 (0)