/** * Insert a list of nodes into the map; overwrite any with that name * This is a bulk operation for testing. * @param nodes collection of nodes. */ @VisibleForTesting public void insert(Collection<NodeInstance> nodes) { for (NodeInstance node : nodes) { put(node.hostname, node); } }
/** * Insert a list of nodes into the map; overwrite any with that name * This is a bulk operation for testing. * @param nodes collection of nodes. */ @VisibleForTesting public void insert(Collection<NodeInstance> nodes) { for (NodeInstance node : nodes) { put(node.hostname, node); } }
/** * Get the node instance for the specific node -creating it if needed * @param hostname node * @return the instance */ public NodeInstance getOrCreate(String hostname) { NodeInstance node = get(hostname); if (node == null) { node = new NodeInstance(hostname, roleSize); put(hostname, node); } return node; }
/** * Get the node instance for the specific node -creating it if needed * @param hostname node * @return the instance */ public NodeInstance getOrCreate(String hostname) { NodeInstance node = get(hostname); if (node == null) { node = new NodeInstance(hostname, roleSize); put(hostname, node); } return node; }