use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.PathChildrenCache in project dubbo by alibaba.
the class ZKTools method testPathCache.
public static void testPathCache() throws Exception {
CuratorFramework client = CuratorFrameworkFactory.newClient("127.0.0.1:2181", 60 * 1000, 60 * 1000, new ExponentialBackoffRetry(1000, 3));
client.start();
PathChildrenCache pathChildrenCache = new PathChildrenCache(client, "/dubbo/config", true);
pathChildrenCache.start(true);
pathChildrenCache.getListenable().addListener((zkClient, event) -> {
System.out.println(event.getData().getPath());
}, Executors.newFixedThreadPool(1));
List<ChildData> dataList = pathChildrenCache.getCurrentData();
dataList.stream().map(ChildData::getPath).forEach(System.out::println);
}
Aggregations