You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by zh...@apache.org on 2020/03/13 06:10:50 UTC

[pulsar] 09/17: Close ZK before canceling future with exception (#6228) (#6399)

This is an automated email from the ASF dual-hosted git repository.

zhaijia pushed a commit to branch branch-2.5
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 30b1818df29e3f57f7b77a80b59ad771b5073a33
Author: Paweł Łoziński <pa...@gmail.com>
AuthorDate: Sat Feb 29 21:53:15 2020 +0100

    Close ZK before canceling future with exception (#6228) (#6399)
    
    Fixes #6228
    
    (cherry picked from commit e6a631d491948119c07a30339c7daf71002c5c0a)
---
 .../java/org/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 aac96ce..8cd674d 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 class ZookeeperBkClientFactoryImpl implements ZooKeeperClientFactory {
                         .build();
 
                 if (zk.getState() == States.CONNECTEDREADONLY && sessionType != SessionType.AllowReadOnly) {
+                    zk.close();
                     future.completeExceptionally(new IllegalStateException("Cannot use a read-only session"));
                 }