Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public void process(WatchedEvent event) {

public void closeConnection() {
try {
zookeeper.close();
if (zookeeper != null) {
zookeeper.close();
}
if (LOG.isDebugEnabled()) {
LOG.debug("Shutting down connection to Zookeeper cluster {}", configuration.getConnectString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Obje
}

private void extractConfigFromUri(String remaining, ZooKeeperConfiguration config) throws URISyntaxException {
URI u = new URI(remaining);
config.addZookeeperServer(u.getHost() + (u.getPort() != -1 ? ":" + u.getPort() : ""));
config.setPath(u.getPath());
URI fullUri = new URI(remaining);
String[] hosts = fullUri.getAuthority().split(",");
for (String host : hosts) {
config.addZookeeperServer(host.trim());
}
config.setPath(fullUri.getPath());
}

public ZooKeeperConfiguration getConfiguration() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ public void process(Exchange exchange) throws Exception {
}
}

@Override
protected void doStop() throws Exception {
super.doStop();
if (log.isTraceEnabled()) {
log.trace(String.format("Shutting down zookeeper producer of '%s'", configuration.getPath()));
}
zkm.shutdown();
}

private void asynchronouslyDeleteNode(ZooKeeper connection, ProductionContext context) {
if (log.isDebugEnabled()) {
log.debug(format("Deleting node '%s', not waiting for confirmation", context.node));
Expand Down