Repository: curator Updated Branches: refs/heads/master 36592e7e3 -> 26fcc3cf2
Support client timeouts < 1000ms Before, regardless of the value set in `connectionTimeoutMs` the CuratorZookeeperClient#internalBlockUntilConnectedOrTimedOut method did the initial wait with value of 1 second, which made settings lower than this value ineffective. This proved problematic in several use cases where such minimum for timeout is prohibitively large. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/1afa38ea Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/1afa38ea Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/1afa38ea Branch: refs/heads/master Commit: 1afa38eab9d1ad878e5b47542922dac2c4485236 Parents: 8a75db8 Author: Martin Betak <[email protected]> Authored: Wed Aug 8 13:51:28 2018 +0200 Committer: Martin Betak <[email protected]> Committed: Wed Aug 8 13:51:28 2018 +0200 ---------------------------------------------------------------------- .../src/main/java/org/apache/curator/CuratorZookeeperClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/1afa38ea/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java ---------------------------------------------------------------------- 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 5032117..7977541 100644 --- a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java +++ b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java @@ -428,9 +428,10 @@ public class CuratorZookeeperClient implements Closeable state.addParentWatcher(tempWatcher); long startTimeMs = System.currentTimeMillis(); + long timeoutMs = Math.min(waitTimeMs, 1000); try { - latch.await(1, TimeUnit.SECONDS); + latch.await(timeoutMs, TimeUnit.MILLISECONDS); } finally {
