public void process(WatchedEvent watchedEvent) {
            switch (watchedEvent.getType()) {
                case NodeChildrenChanged: // Fleetcontrollers have either connected or disconnected to ZooKeeper
                    log.log(Level.INFO, "Fleetcontroller " + nodeIndex + ": A change occurred in the list of registered fleetcontrollers. Requesting new information");
                    session.getChildren(paths.indexesRoot(), this, childListener, null);
                    break;
                case NodeDataChanged: // A fleetcontroller has changed what node it is voting for
                    log.log(Level.INFO, "Fleetcontroller " + nodeIndex + ": Altered data in node " + watchedEvent.getPath() + ". Requesting new vote");
                    int index = getIndex(watchedEvent.getPath());
                    synchronized (nextMasterData) {
                        nextMasterData.put(index, null);
                    }
                    session.getData(paths.indexOf(index), this, nodeListener, null);
                    break;
                case NodeCreated: // How can this happen? Can one leave watches on non-existing nodes?
                    log.log(Level.WARNING, "Fleetcontroller " + nodeIndex + ": Got unexpected ZooKeeper event NodeCreated");
                    break;
                case NodeDeleted:
                        // We get this event when fleetcontrollers shut down and node in dir disappears. But it should also trigger a NodeChildrenChanged event, so
                        // ignoring this one.
                    log.log(Level.FINE, () -> "Fleetcontroller " + nodeIndex + ": Node deleted event gotten. Ignoring it, expecting a NodeChildrenChanged event too.");
                    break;
                case None:
                    log.log(Level.FINE, () -> "Fleetcontroller " + nodeIndex + ": Got ZooKeeper event None.");
            }
        }
This class is used to handle node children changed and node data changed events from the zookeeper server.
A run to fetch new master data starts with either of these changes, except for the first time on startup,
where the constructor triggers a run by requesting dir info, as it starts of knowing nothing.
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/database/MasterDataGatherer.java