use of org.apache.storm.utils.ZookeeperAuthInfo in project storm by apache.
the class BlobStoreUtils method createZKClient.
public static CuratorFramework createZKClient(Map<String, Object> conf) {
@SuppressWarnings("unchecked") List<String> zkServers = (List<String>) conf.get(Config.STORM_ZOOKEEPER_SERVERS);
Object port = conf.get(Config.STORM_ZOOKEEPER_PORT);
ZookeeperAuthInfo zkAuthInfo = new ZookeeperAuthInfo(conf);
CuratorFramework zkClient = Utils.newCurator(conf, zkServers, port, (String) conf.get(Config.STORM_ZOOKEEPER_ROOT), zkAuthInfo);
zkClient.start();
return zkClient;
}
use of org.apache.storm.utils.ZookeeperAuthInfo in project storm by apache.
the class Zookeeper method mkClientImpl.
public CuratorFramework mkClientImpl(Map conf, List<String> servers, Object port, String root, final WatcherCallBack watcher, Map authConf) {
CuratorFramework fk;
if (authConf != null) {
fk = Utils.newCurator(conf, servers, port, root, new ZookeeperAuthInfo(authConf));
} else {
fk = Utils.newCurator(conf, servers, port, root);
}
fk.getCuratorListenable().addListener(new CuratorListener() {
@Override
public void eventReceived(CuratorFramework _fk, CuratorEvent e) throws Exception {
if (e.getType().equals(CuratorEventType.WATCHED)) {
WatchedEvent event = e.getWatchedEvent();
watcher.execute(event.getState(), event.getType(), event.getPath());
}
}
});
LOG.info("Staring ZK Curator");
fk.start();
return fk;
}
Aggregations