/** * List the active nodes * @param role role * @return a possibly empty sorted list of all nodes that are active * in that role */ public List<NodeInstance> listActiveNodes(int role) { List<NodeInstance> nodes = new ArrayList<>(); for (NodeInstance instance : values()) { if (instance.getActiveRoleInstances(role) > 0) { nodes.add(instance); } } Collections.sort(nodes, new NodeInstance.MoreActiveThan(role)); return nodes; }
/** * List the active nodes * @param role role * @return a possibly empty sorted list of all nodes that are active * in that role */ public List<NodeInstance> listActiveNodes(int role) { List<NodeInstance> nodes = new ArrayList<>(); for (NodeInstance instance : values()) { if (instance.getActiveRoleInstances(role) > 0) { nodes.add(instance); } } Collections.sort(nodes, new NodeInstance.MoreActiveThan(role)); return nodes; }
/** * Scan the current node map for all nodes capable of hosting an instance * @param role role ID * @param label label which must match, or "" for no label checks * @return a possibly empty list of node instances matching the criteria. */ public List<NodeInstance> findAllNodesForRole(int role, String label) { List<NodeInstance> nodes = new ArrayList<>(size()); for (NodeInstance instance : values()) { if (instance.canHost(role, label)) { nodes.add(instance); } } Collections.sort(nodes, new NodeInstance.CompareNames()); return nodes; }
/** * Scan the current node map for all nodes capable of hosting an instance * @param role role ID * @param label label which must match, or "" for no label checks * @return a possibly empty list of node instances matching the criteria. */ public List<NodeInstance> findAllNodesForRole(int role, String label) { List<NodeInstance> nodes = new ArrayList<>(size()); for (NodeInstance instance : values()) { if (instance.canHost(role, label)) { nodes.add(instance); } } Collections.sort(nodes, new NodeInstance.CompareNames()); return nodes; }
/** * Print the history to the log. This is for testing and diagnostics */ public synchronized void dump() { for (ProviderRole role : providerRoles) { log.info(role.toString()); List<NodeInstance> instances = listRecentNodesForRoleId(role.id); log.info(" available: " + instances.size() + " " + SliderUtils.joinWithInnerSeparator(" ", instances)); } log.info("Nodes in Cluster: {}", getClusterSize()); for (NodeInstance node : nodemap.values()) { log.info(node.toFullString()); } }
/** * Print the history to the log. This is for testing and diagnostics */ public synchronized void dump() { for (ProviderRole role : providerRoles) { log.info(role.toString()); List<NodeInstance> instances = listRecentNodesForRoleId(role.id); log.info(" available: " + instances.size() + " " + SliderUtils.joinWithInnerSeparator(" ", instances)); } log.info("Nodes in Cluster: {}", getClusterSize()); for (NodeInstance node : nodemap.values()) { log.info(node.toFullString()); } }
long count = 0; Collection<NodeInstance> instances = history.cloneNodemap().values(); for (NodeInstance instance : instances) { for (int role = 0; role < roles; role++) {
long count = 0; Collection<NodeInstance> instances = history.cloneNodemap().values(); for (NodeInstance instance : instances) { for (int role = 0; role < roles; role++) {