/**
* @see org.apache.zookeeper.Watcher#process(org.apache.zookeeper.WatchedEvent)
*/
@Override
public synchronized void process(WatchedEvent event) {
EventType type = event.getType();
LOG.debug(("Got event " + type + " with path " + event.getPath()));
if (type.equals(EventType.NodeDeleted)) {
if(event.getPath().equals(this.zooKeeper.clusterStateZNode)) {
LOG.info("The cluster was shutdown while waiting, shutting down" +
" this master.");
master.shutdownRequested.set(true);
}
else {
LOG.debug("Master address ZNode deleted, notifying waiting masters");
notifyAll();
}
}
else if(type.equals(EventType.NodeCreated) &&
event.getPath().equals(this.zooKeeper.clusterStateZNode)) {
LOG.debug("Resetting the watch on the cluster state node.");
this.zooKeeper.setClusterStateWatch(this);
}
}