/** * reset the failed recently counters */ public void resetFailedRecently() { for (Map.Entry<String, NodeInstance> entry : entrySet()) { NodeInstance ni = entry.getValue(); ni.resetFailedRecently(); } }
/** * reset the failed recently counters */ public void resetFailedRecently() { for (Map.Entry<String, NodeInstance> entry : entrySet()) { NodeInstance ni = entry.getValue(); ni.resetFailedRecently(); } }
/** * Get snapshot of the node map * @return a snapshot of the current node state * @param naming naming map of priority to enty name; entries must be unique. * It's OK to be incomplete, for those the list falls back to numbers. */ public synchronized Map<String, NodeInformation> getNodeInformationSnapshot( Map<Integer, String> naming) { Map<String, NodeInformation> result = new HashMap<>(nodemap.size()); for (Map.Entry<String, NodeInstance> entry : nodemap.entrySet()) { result.put(entry.getKey(), entry.getValue().serialize(naming)); } return result; }
/** * Get snapshot of the node map * @return a snapshot of the current node state * @param naming naming map of priority to enty name; entries must be unique. * It's OK to be incomplete, for those the list falls back to numbers. */ public synchronized Map<String, NodeInformation> getNodeInformationSnapshot( Map<Integer, String> naming) { Map<String, NodeInformation> result = new HashMap<>(nodemap.size()); for (Map.Entry<String, NodeInstance> entry : nodemap.entrySet()) { result.put(entry.getKey(), entry.getValue().serialize(naming)); } return result; }
/** * (After the start), rebuild the availability data structures */ @VisibleForTesting public synchronized void buildRecentNodeLists() { resetAvailableNodeLists(); // build the list of available nodes for (Map.Entry<String, NodeInstance> entry : nodemap.entrySet()) { NodeInstance ni = entry.getValue(); for (int i = 0; i < roleSize; i++) { NodeEntry nodeEntry = ni.get(i); if (nodeEntry != null && nodeEntry.isAvailable()) { log.debug("Adding {} for role {}", ni, i); listRecentNodesForRoleId(i).add(ni); } } } // sort the resulting arrays for (int i = 0; i < roleSize; i++) { sortRecentNodeList(i); } }
List<String> blacklistAdditions = new ArrayList<>(); List<String> blacklistRemovals = new ArrayList<>(); for (Entry<String, NodeInstance> nodeInstanceEntry : nodemap.entrySet()) { boolean shouldBeBlacklisted = false; String nodeHost = nodeInstanceEntry.getKey();
List<String> blacklistAdditions = new ArrayList<>(); List<String> blacklistRemovals = new ArrayList<>(); for (Entry<String, NodeInstance> nodeInstanceEntry : nodemap.entrySet()) { boolean shouldBeBlacklisted = false; String nodeHost = nodeInstanceEntry.getKey();
/** * (After the start), rebuild the availability data structures */ @VisibleForTesting public synchronized void buildRecentNodeLists() { resetAvailableNodeLists(); // build the list of available nodes for (Map.Entry<String, NodeInstance> entry : nodemap.entrySet()) { NodeInstance ni = entry.getValue(); for (int i = 0; i < roleSize; i++) { NodeEntry nodeEntry = ni.get(i); if (nodeEntry != null && nodeEntry.isAvailable()) { log.debug("Adding {} for role {}", ni, i); listRecentNodesForRoleId(i).add(ni); } } } // sort the resulting arrays for (int i = 0; i < roleSize; i++) { sortRecentNodeList(i); } }