hadoop-zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neptune <opennept...@gmail.com>
Subject How do I get added child znode?
Date Tue, 16 Feb 2010 13:47:49 GMT
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message