4.5 判断子节点是否存在

@Test
public void exists() throws KeeperException, InterruptedException {
    /*
        参数1: 要判断的路径
        参数2: 这个节点的监听器.(null 表示不监听)
    */
    Stat stat = zkClient.exists("/atguigu", null);
    System.out.println(stat == null ? "not exists" : "exists");
    Thread.sleep(10000000);
}
Copyright © 尚硅谷大数据 & 2019 all right reserved,powered by Gitbook
该文件最后修订时间: 2018-10-18 11:15:51

results matching ""

    No results matching ""