private void updateClusterState(boolean onlyLiveNodes) throws KeeperException, InterruptedException { // build immutable CloudInfo synchronized (getUpdateLock()) { List<String> liveNodes = zkClient.getChildren(LIVE_NODES_ZKNODE, null, true); Set<String> liveNodesSet = new HashSet<>(liveNodes); if (!onlyLiveNodes) { log.debug("Updating cloud state from ZooKeeper... "); clusterState = constructState(liveNodesSet, null); } else { log.debug("Updating live nodes from ZooKeeper... ({})", liveNodesSet.size()); clusterState = this.clusterState; clusterState.setLiveNodes(liveNodesSet); } } }
this.liveNodes = newLiveNodes; if (clusterState != null) { clusterState.setLiveNodes(newLiveNodes);
clusterState.setLiveNodes(liveNodesSet);