@Test(timeout = 5000) public void testActivateNodeManagerWithZeroPort() throws Exception { mgr.activateNode(NodeId.newInstance("n1", 0), SMALL_RESOURCE); mgr.activateNode(NodeId.newInstance("n1", 2), LARGE_NODE); }
public void activateNode(NodeId nodeId, Resource resource) { try { writeLock.lock(); Map<String, Host> before = cloneNodeMap(ImmutableSet.of(nodeId)); createHostIfNonExisted(nodeId.getHost()); try { createNodeIfNonExisted(nodeId); } catch (IOException e) { LOG.error("This shouldn't happen, cannot get host in nodeCollection" + " associated to the node being activated"); return; } Node nm = getNMInNodeSet(nodeId); nm.resource = resource; nm.running = true; Map<String, Host> after = cloneNodeMap(ImmutableSet.of(nodeId)); updateResourceMappings(before, after); } finally { writeLock.unlock(); } }
RMNodeLabelsManager extends CommonNodeLabelsManager { public void activateNode(NodeId nodeId, Resource resource) { try { writeLock.lock(); Map<String, Host> before = cloneNodeMap(ImmutableSet.of(nodeId)); createHostIfNonExisted(nodeId.getHost()); try { createNodeIfNonExisted(nodeId); } catch (IOException e) { LOG.error("This shouldn't happen, cannot get host in nodeCollection" + " associated to the node being activated"); return; } Node nm = getNMInNodeSet(nodeId); nm.resource = resource; nm.running = true; Map<String, Host> after = cloneNodeMap(ImmutableSet.of(nodeId)); updateResourceMappings(before, after); } finally { writeLock.unlock(); } } }
RMNodeLabelsManager extends CommonNodeLabelsManager { public void activateNode(NodeId nodeId, Resource resource) { try { writeLock.lock(); Map<String, Host> before = cloneNodeMap(ImmutableSet.of(nodeId)); createHostIfNonExisted(nodeId.getHost()); try { createNodeIfNonExisted(nodeId); } catch (IOException e) { LOG.error("This shouldn't happen, cannot get host in nodeCollection" + " associated to the node being activated"); return; } Node nm = getNMInNodeSet(nodeId); nm.resource = resource; nm.running = true; Map<String, Host> after = cloneNodeMap(ImmutableSet.of(nodeId)); updateResourceMappings(before, after); } finally { writeLock.unlock(); } }  }
RMNodeLabelsManager extends CommonNodeLabelsManager { public void activateNode(NodeId nodeId, Resource resource) { try { writeLock.lock(); Map<String, Host> before = cloneNodeMap(ImmutableSet.of(nodeId)); createHostIfNonExisted(nodeId.getHost()); try { createNodeIfNonExisted(nodeId); } catch (IOException e) { LOG.error("This shouldn't happen, cannot get host in nodeCollection" + " associated to the node being activated"); return; } Node nm = getNMInNodeSet(nodeId); nm.resource = resource; nm.running = true; Map<String, Host> after = cloneNodeMap(ImmutableSet.of(nodeId)); updateResourceMappings(before, after); } finally { writeLock.unlock(); } }  @Override void addLabelsToNode(Map<NodeId, Set<String>> addedLabelsToNode); @Override void removeFromClusterNodeLabels(Collection<String> labelsToRemove); @Override void removeLabelsFromNode(Map<NodeId, Set<String>> removeLabelsFromNode); @Override void replaceLabelsOnNode(Map<NodeId, Set<String>> replaceLabelsToNode); void activateNode(NodeId nodeId, Resource resource); void deactivateNode(NodeId nodeId); void updateNodeResource(NodeId node, Resource newResource); void reinitializeQueueLabels(Map<String, Set<String>> queueToLabels); Resource getQueueResource(String queueName, Set<String> queueLabels,
      Resource clusterResource); Set<String> getLabelsOnNode(NodeId nodeId); boolean containsNodeLabel(String label); Resource getResourceByLabel(String label, Resource clusterResource); boolean checkAccess(UserGroupInformation user); void setRMContext(RMContext rmContext); }
RMNodeLabelsManager extends CommonNodeLabelsManager { public void activateNode(NodeId nodeId, Resource resource) { try { writeLock.lock(); Map<String, Host> before = cloneNodeMap(ImmutableSet.of(nodeId)); createHostIfNonExisted(nodeId.getHost()); try { createNodeIfNonExisted(nodeId); } catch (IOException e) { LOG.error("This shouldn't happen, cannot get host in nodeCollection" + " associated to the node being activated"); return; } Node nm = getNMInNodeSet(nodeId); nm.resource = resource; nm.running = true; Map<String, Host> after = cloneNodeMap(ImmutableSet.of(nodeId)); updateResourceMappings(before, after); } finally { writeLock.unlock(); } }  @Override void addLabelsToNode(Map<NodeId, Set<String>> addedLabelsToNode); @Override void removeFromClusterNodeLabels(Collection<String> labelsToRemove); @Override void removeLabelsFromNode(Map<NodeId, Set<String>> removeLabelsFromNode); @Override void replaceLabelsOnNode(Map<NodeId, Set<String>> replaceLabelsToNode); void activateNode(NodeId nodeId, Resource resource); void deactivateNode(NodeId nodeId); void updateNodeResource(NodeId node, Resource newResource); void reinitializeQueueLabels(Map<String, Set<String>> queueToLabels); Resource getQueueResource(String queueName, Set<String> queueLabels,
      Resource clusterResource); Set<String> getLabelsOnNode(NodeId nodeId); boolean containsNodeLabel(String label); Resource getResourceByLabel(String label, Resource clusterResource); boolean checkAccess(UserGroupInformation user); void setRMContext(RMContext rmContext);  }