/** * Update the node state. Return true if the node state changed: either by * being created, or by changing its internal state as defined * by {@link NodeInstance#updateNode(NodeReport)}. * * @param hostname host name * @param report latest node report * @return true if the node state changed enough for a request evaluation. */ public boolean updateNode(String hostname, NodeReport report) { boolean nodeExisted = get(hostname) != null; boolean updated = getOrCreate(hostname).updateNode(report); return updated || !nodeExisted; }
/** * Update the node state. Return true if the node state changed: either by * being created, or by changing its internal state as defined * by {@link NodeInstance#updateNode(NodeReport)}. * * @param hostname host name * @param report latest node report * @return true if the node state changed enough for a request evaluation. */ public boolean updateNode(String hostname, NodeReport report) { boolean nodeExisted = get(hostname) != null; boolean updated = getOrCreate(hostname).updateNode(report); return updated || !nodeExisted; }
/** * Test helper: build or update a cluster from a list of node reports * @param reports the list of reports * @return true if this has been considered to have changed the cluster */ @VisibleForTesting public boolean buildOrUpdate(List<NodeReport> reports) { boolean updated = false; for (NodeReport report : reports) { updated |= getOrCreate(report.getNodeId().getHost()).updateNode(report); } return updated; }
/** * Test helper: build or update a cluster from a list of node reports * @param reports the list of reports * @return true if this has been considered to have changed the cluster */ @VisibleForTesting public boolean buildOrUpdate(List<NodeReport> reports) { boolean updated = false; for (NodeReport report : reports) { updated |= getOrCreate(report.getNodeId().getHost()).updateNode(report); } return updated; }