private void updateMasterNode(final List<String> enabledNodesByPriority) {
        if (!enabledNodesByPriority.isEmpty()) {
            // Master node is the one with the highest priority. If two
            // or more nodes have the same and highest priority then the master
            // is the first node when sorted on ascending node name.
            // enabledNodesByPriority may contain nodes that we can't ping so find the
            // first one that has been deemed active by checking in clusterState which
            // has been mutated in the background based on ping results
            enabledNodesByPriority.stream()
                    .filter(clusterState::isEnabledAndActive)
                    .findFirst()
                    .ifPresent(newMasterNodeName -> {
                        final String oldMasterNodeName = clusterState.setMasterNodeName(newMasterNodeName);
                        if (!Objects.equals(oldMasterNodeName, newMasterNodeName)) {
                            if (oldMasterNodeName == null) {
                                LOGGER.info("Master node is {}", newMasterNodeName);
                            } else {
                                LOGGER.info("Master node has changed from {} to {}",
                                        oldMasterNodeName, newMasterNodeName);
                            }
                        }
                    });
        }
    }
Trigger a re-discover if the node saves
stroom-cluster/stroom-cluster-impl/src/main/java/stroom/cluster/impl/ClusterNodeManagerImpl.java