Search in sources :

Example 1 with WatchedEvent

use of org.apache.storm.shade.org.apache.zookeeper.WatchedEvent in project storm by apache.

the class ClientZookeeper method mkClientImpl.

public CuratorFramework mkClientImpl(Map<String, Object> conf, List<String> servers, Object port, String root, final WatcherCallBack watcher, Map<String, Object> authConf, DaemonType type) {
    CuratorFramework fk;
    if (authConf != null) {
        fk = CuratorUtils.newCurator(conf, servers, port, root, new ZookeeperAuthInfo(authConf), type.getDefaultZkAcls(conf));
    } else {
        fk = CuratorUtils.newCurator(conf, servers, port, root, null, type.getDefaultZkAcls(conf));
    }
    fk.getCuratorListenable().addListener((unused, e) -> {
        if (e.getType().equals(CuratorEventType.WATCHED)) {
            WatchedEvent event = e.getWatchedEvent();
            watcher.execute(event.getState(), event.getType(), event.getPath());
        }
    });
    LOG.info("Starting ZK Curator");
    fk.start();
    return fk;
}
Also used : WatchedEvent(org.apache.storm.shade.org.apache.zookeeper.WatchedEvent) CuratorFramework(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework) ZookeeperAuthInfo(org.apache.storm.utils.ZookeeperAuthInfo)

Aggregations

CuratorFramework (org.apache.storm.shade.org.apache.curator.framework.CuratorFramework)1 WatchedEvent (org.apache.storm.shade.org.apache.zookeeper.WatchedEvent)1 ZookeeperAuthInfo (org.apache.storm.utils.ZookeeperAuthInfo)1