From c41498e90480bf7aa92dda17f38d39ebc4b2cb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=81ozi=C5=84ski?= Date: Sat, 29 Feb 2020 21:53:15 +0100 Subject: [PATCH] Close ZK before canceling future with exception (#6228) (#6399) Fixes #6228 (cherry picked from commit e6a631d491948119c07a30339c7daf71002c5c0a) --- .../apache/pulsar/zookeeper/ZookeeperBkClientFactoryImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pulsar-zookeeper-utils/src/main/java/org/apache/pulsar/zookeeper/ZookeeperBkClientFactoryImpl.java b/pulsar-zookeeper-utils/src/main/java/org/apache/pulsar/zookeeper/ZookeeperBkClientFactoryImpl.java index aac96ce84c5c1..8cd674d580dfe 100644 --- a/pulsar-zookeeper-utils/src/main/java/org/apache/pulsar/zookeeper/ZookeeperBkClientFactoryImpl.java +++ b/pulsar-zookeeper-utils/src/main/java/org/apache/pulsar/zookeeper/ZookeeperBkClientFactoryImpl.java @@ -55,6 +55,7 @@ public CompletableFuture 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")); }