public static String getnodes(String nodepath) throws IOException, KeeperException, Exception {
// String nodePath="/configurations";
ZooKeeper zk = new ZooKeeper("172.0.0.0:" + 2181, 3000,
new Watcher() {
// 监控所有被触发的事件
public void process(WatchedEvent event) {
System.out.println("已经触发了" + event.getType() + "事件!");
}
});
//递归查找非空子节点
List<String> list = zk.getChildren(nodepath, true);
for (String str : list) {
getnodes( nodepath + "/" + str);
System.out.println(nodepath + "/" + str);
}
return nodepath;
}