From 3d9d39cdb8e522f2aeeefd051c3c0a6962a85b6b Mon Sep 17 00:00:00 2001 From: Andrey Dyachkov Date: Tue, 11 Jun 2019 16:30:12 +0200 Subject: [PATCH] take connection string from exhib client --- .../nakadi/repository/zookeeper/ZooKeeperHolder.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/zalando/nakadi/repository/zookeeper/ZooKeeperHolder.java b/src/main/java/org/zalando/nakadi/repository/zookeeper/ZooKeeperHolder.java index 68c39bea18..4aaa229a8d 100644 --- a/src/main/java/org/zalando/nakadi/repository/zookeeper/ZooKeeperHolder.java +++ b/src/main/java/org/zalando/nakadi/repository/zookeeper/ZooKeeperHolder.java @@ -31,7 +31,6 @@ public class ZooKeeperHolder { private final Integer exhibitorPort; private final Integer sessionTimeoutMs; private final Integer connectionTimeoutMs; - private final String connectionString; private CuratorFramework zooKeeper; @@ -47,8 +46,6 @@ public ZooKeeperHolder(final String zookeeperBrokers, this.exhibitorPort = exhibitorPort; this.sessionTimeoutMs = sessionTimeoutMs; this.connectionTimeoutMs = connectionTimeoutMs; - this.connectionString = - (exhibitorAddresses == null ? zookeeperBrokers : exhibitorAddresses) + zookeeperKafkaNamespace; initExhibitor(); } @@ -83,8 +80,10 @@ public CuratorFramework get() { public Closeable newZookeeperLock(final String lockObject, final long timeoutMs) throws RuntimeException { try { - final ZookeeperLock zookeeperLock = new ZookeeperLock(new ZooKeeper(connectionString, - sessionTimeoutMs, new NakadiZookeeperWatcher())); + final ZookeeperLock zookeeperLock = new ZookeeperLock(new ZooKeeper( + zooKeeper.getZookeeperClient().getCurrentConnectionString(), + sessionTimeoutMs, + new NakadiZookeeperWatcher())); return zookeeperLock.tryLock(lockObject, timeoutMs); } catch (final Exception e) { throw new RuntimeException("Failed to get zookeeper client", e); @@ -96,7 +95,7 @@ private static class NakadiZookeeperWatcher implements Watcher { @Override public void process(final WatchedEvent event) { - LOG.info("{}", event); + LOG.debug("{}", event); } }