/** * Return true if the node is not busy, and it * has not been used since the absolute time * @param absoluteTime time * @return true if the node could be cleaned up */ public synchronized boolean notUsedSince(long absoluteTime) { return isAvailable() && lastUsed < absoluteTime; }
/** * Return true if the node is not busy, and it * has not been used since the absolute time * @param absoluteTime time * @return true if the node could be cleaned up */ public synchronized boolean notUsedSince(long absoluteTime) { return isAvailable() && lastUsed < absoluteTime; }
/** * Is this node instance a suitable candidate for the specific role? * @param role role ID * @param label label which must match, or "" for no label checks * @return true if the node has space for this role, is running and the labels * match. */ public boolean canHost(int role, String label) { return isOnline() && (SliderUtils.isUnset(label) || label.equals(nodeLabels)) // label match && getOrCreate(role).isAvailable(); // no live role }
/** * Is this node instance a suitable candidate for the specific role? * @param role role ID * @param label label which must match, or "" for no label checks * @return true if the node has space for this role, is running and the labels * match. */ public boolean canHost(int role, String label) { return isOnline() && (SliderUtils.isUnset(label) || label.equals(nodeLabels)) // label match && getOrCreate(role).isAvailable(); // no live role }
/** * (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); } }
/** * (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); } }