From 89f19cf86a71f0c6a6d4f06b0c10739528a01576 Mon Sep 17 00:00:00 2001 From: Houston Putman Date: Wed, 4 Dec 2024 11:36:05 -0600 Subject: [PATCH] CURATOR-720: Stop retry if client is closed --- .../main/java/org/apache/curator/CuratorZookeeperClient.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java index ecb072f65..44163e92c 100644 --- a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java +++ b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java @@ -399,6 +399,9 @@ void removeParentWatcher(Watcher watcher) { public void internalBlockUntilConnectedOrTimedOut() throws InterruptedException { long waitTimeMs = connectionTimeoutMs; while (!state.isConnected() && (waitTimeMs > 0)) { + if (!started.get()) { + throw new IllegalStateException("Client is not started"); + } final CountDownLatch latch = new CountDownLatch(1); Watcher tempWatcher = new Watcher() { @Override