Hi all, I'm kimhj.

I have a question. I registered a Watcher on a parent znode("/foo").
I create child znode("/foo/bar1") using a zookeeper console.
Test program received Children changed event. But there is no API getting
added znode.
ZooKeeper.getChildren() method returns all children in a parent node.

public class ZkTest implements Watcher {
  ZooKeeper zk;
  public void test() {
    zk = new ZooKeeper("127.0.0.1:2181", 10 * 1000, this);
    zk.create("/foo", false);
    zk.getChild("/foo", this);
  }

  public void process(WatchedEvent event) {
    if(event.getType() == Event.EventType.NodeChildrenChanged) {
      *List<String> children = zk.getChildren(event.getPath(), this);*
    }
  }
}

Thanks.

Reply via email to