Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
take connection string from exhib client
Browse files Browse the repository at this point in the history
  • Loading branch information
adyach committed Jun 11, 2019
1 parent aed6353 commit 3d9d39c
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
}
Expand Down Expand Up @@ -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);
Expand All @@ -96,7 +95,7 @@ private static class NakadiZookeeperWatcher implements Watcher {

@Override
public void process(final WatchedEvent event) {
LOG.info("{}", event);
LOG.debug("{}", event);
}
}

Expand Down

0 comments on commit 3d9d39c

Please sign in to comment.