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é
|