/** * Create a new Anti-affine request for the specific role * <p> * It is added to {@link #openRequests} * <p> * This does not update the node instance's role's request count * @param role role index * @param nodes list of suitable nodes * @param label label to use * @return a new request */ public synchronized OutstandingRequest newAARequest(int role, List<NodeInstance> nodes, String label) { Preconditions.checkArgument(!nodes.isEmpty()); // safety check to verify the allocation will hold for (NodeInstance node : nodes) { Preconditions.checkState(node.canHost(role, label), "Cannot allocate role ID %d to node %s", role, node); } OutstandingRequest request = new OutstandingRequest(role, nodes); openRequests.add(request); return request; }
/** * Create a new Anti-affine request for the specific role * <p> * It is added to {@link #openRequests} * <p> * This does not update the node instance's role's request count * @param role role index * @param nodes list of suitable nodes * @param label label to use * @return a new request */ public synchronized OutstandingRequest newAARequest(int role, List<NodeInstance> nodes, String label) { Preconditions.checkArgument(!nodes.isEmpty()); // safety check to verify the allocation will hold for (NodeInstance node : nodes) { Preconditions.checkState(node.canHost(role, label), "Cannot allocate role ID %d to node %s", role, node); } OutstandingRequest request = new OutstandingRequest(role, nodes); openRequests.add(request); return request; }
/** * 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; }
if (node.canHost(role.getKey(), role.getLabelExpression())) { log.error("Assigned node still declares as available {}", node.toFullString() );
if (node.canHost(role.getKey(), role.getLabelExpression())) { log.error("Assigned node still declares as available {}", node.toFullString() );