Zookeeper删除目录

ZooKeeper zk=new ZooKeeper(host, timeout, new Watcher(){})
public void delPath(String path) throws Exception{
        List<String> paths=zk.getChildren(path, false);
        for (String p:paths){
            delPath(path+"/"+p);
            System.out.println(path+"/"+p);
        }
        for(String p:paths){
            zk.delete(path+"/"+p, -1);
        }
    }
//call function
delPath("/yourpath");

没有更多推荐了,返回首页