zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Oriani <ra078...@students.ic.unicamp.br>
Subject Are Watchers execute sequentially or in parallel ?
Date Tue, 29 Jun 2010 13:13:05 GMT
Hi,

Are Watchers executed sequentially  or in parallel ? Suppose I want to
monitor the children of a znode for any modification.  I don't want the same
watcher to be re-executed while it is still executing.



1)

public class ChildrenWatcher implements Watcher{

     public void process(WatchedEvent event) {

          //get children and install watcher
          List<String> children = zk.getChildren(path, this);

                   //process children

    }
}



2)

public class ChildrenWatcher implements Watcher{

     public void process(WatchedEvent event) {

          //get children
          List<String> children = zk.getChildren(path, null);

                   //process children

         //install watcher
         zk.getChildren(path, null)
    }
}



Does both code achieve the goal or just the code number 2 ?


Tks,
André

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