public void tick() throws Exception {
        synchronized (monitor) {
            boolean didWork;
            didWork = metricUpdater.forWork("doNextZooKeeperTask", () -> database.doNextZooKeeperTask(databaseContext));
            didWork |= metricUpdater.forWork("updateMasterElectionState", this::updateMasterElectionState);
            didWork |= metricUpdater.forWork("handleLeadershipEdgeTransitions", this::handleLeadershipEdgeTransitions);
            stateChangeHandler.setMaster(isMaster);

            if ( ! isRunning()) { return; }
            // Process zero or more getNodeState responses that we have received.
            didWork |= metricUpdater.forWork("stateGatherer-processResponses", () -> stateGatherer.processResponses(this));

            if ( ! isRunning()) { return; }

            if (masterElectionHandler.isFirstInLine()) {
                didWork |= resyncLocallyCachedState(); // Calls to metricUpdate.forWork inside method
            } else {
                stepDownAsStateGatherer();
            }

            if ( ! isRunning()) { return; }
            didWork |= metricUpdater.forWork("systemStateBroadcaster-processResponses", systemStateBroadcaster::processResponses);
            if ( ! isRunning()) { return; }
            if (isMaster) {
                didWork |= metricUpdater.forWork("broadcastClusterStateToEligibleNodes", this::broadcastClusterStateToEligibleNodes);
                systemStateBroadcaster.checkIfClusterStateIsAckedByAllDistributors(database, databaseContext, this);
            }

            if ( ! isRunning()) { return; }
            didWork |= metricUpdater.forWork("processAnyPendingStatusPageRequest", this::processAnyPendingStatusPageRequest);
            if ( ! isRunning()) { return; }
            if (rpcServer != null) {
                didWork |= metricUpdater.forWork("handleRpcRequests", () -> rpcServer.handleRpcRequests(cluster, consolidatedClusterState(), this));
            }

            if ( ! isRunning()) { return; }
            didWork |= metricUpdater.forWork("processNextQueuedRemoteTask", this::processNextQueuedRemoteTask);
            didWork |= metricUpdater.forWork("completeSatisfiedVersionDependentTasks", this::completeSatisfiedVersionDependentTasks);
            didWork |= metricUpdater.forWork("maybePublishOldMetrics", this::maybePublishOldMetrics);

            processingCycle = false;
            ++cycleCount;
            long tickStopTime = timer.getCurrentTimeInMillis();
            if (tickStopTime >= tickStartTime) {
                metricUpdater.addTickTime(tickStopTime - tickStartTime, didWork);
            }
            // Always sleep some to avoid using too much CPU and avoid starving waiting threads
            monitor.wait(didWork || waitingForCycle ? 1 : options.cycleWaitTime());
            if ( ! isRunning()) { return; }
            tickStartTime = timer.getCurrentTimeInMillis();
            processingCycle = true;
            if (nextOptions != null) { // if reconfiguration has given us new options, propagate them
                switchToNewConfig();
            }
        }
        if (isRunning()) {
            propagateNewStatesToListeners();
        }
    }
This is called when the options field has been set to a new set of options
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java