Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper >> mail # user >> the event is not nidified

Copy link to this message
the event is not nidified
I use Zookeeper 3.3.3 version.

I create "test" znode, and I add many children for the znode. I want to
listen EventType.NodeChildrenChanged event, when there is
EventType.NodeChildrenChanged event, I print the event information, example
below code:

public class DisplayGroup implements Watcher {

    private static final int SESSION_TIMEOUT = 5000;

    protected ZooKeeper zk;

    public void connect(String hosts) throws IOException,
InterruptedException {
        zk = new ZooKeeper(hosts, SESSION_TIMEOUT, this);


    public void process(WatchedEvent event) {

        System.out.println(this.getClass().getName() + ": " + event);

    public void close() throws InterruptedException {

    public void list(String groupName) throws KeeperException,
            InterruptedException {
        String path = "/" + groupName;
        try {

            List<String> children = zk.getChildren(path, true);
            if (children.isEmpty()) {
                System.out.printf("No members in group %s\n", groupName);

            for (String child : children) {
        } catch (KeeperException.NoNodeException e) {
            System.out.printf("Group %s does not exist\n", groupName);


    public static void main(String[] args) throws Exception {
        DisplayGroup listGroup = new DisplayGroup();
        String connectString = "localhost:2181";

I add many children to the "test" znode, but the process() method of
DisplayGroup  calss only is called one time, the output information is�
examples.DisplayGroup: WatchedEvent state:SyncConnected
type:NodeChildrenChanged path:/test

I want to know why the process() method of DisplayGroup  calss is not called
many times when I add many children to the "test" znode?