@Test(timeout = 5000) public void testPullRMNodeLabelsInfo() throws IOException { mgr.addToCluserNodeLabels(toSet("x", "y", "z")); mgr.activateNode(NodeId.newInstance("n1", 1), Resource.newInstance(10, 0, 0)); mgr.activateNode(NodeId.newInstance("n2", 1), Resource.newInstance(10, 0, 0)); mgr.activateNode(NodeId.newInstance("n3", 1), Resource.newInstance(10, 0, 0)); mgr.activateNode(NodeId.newInstance("n4", 1), Resource.newInstance(10, 0, 0)); mgr.activateNode(NodeId.newInstance("n5", 1), Resource.newInstance(10, 0, 0)); mgr.replaceLabelsOnNode(ImmutableMap.of(toNodeId("n1"), toSet("x"), toNodeId("n2"), toSet("x"), toNodeId("n3"), toSet("y"))); List<NodeLabel> infos = mgr.pullRMNodeLabelsInfo(); Assert.assertEquals(4, infos.size()); checkNodeLabelInfo(infos, RMNodeLabelsManager.NO_LABEL, 2, 20); checkNodeLabelInfo(infos, "x", 2, 20); checkNodeLabelInfo(infos, "y", 1, 10); checkNodeLabelInfo(infos, "z", 0, 0); }
public List<NodeLabel> pullRMNodeLabelsInfo() { try { readLock.lock(); List<NodeLabel> infos = new ArrayList<NodeLabel>(); for (Entry<String, NodeLabel> entry : labelCollections.entrySet()) { NodeLabel label = entry.getValue(); infos.add(label.getCopy()); } Collections.sort(infos); return infos; } finally { readLock.unlock(); } }
RMNodeLabelsManager extends CommonNodeLabelsManager { public List<NodeLabel> pullRMNodeLabelsInfo() { try { readLock.lock(); List<NodeLabel> infos = new ArrayList<NodeLabel>(); for (Entry<String, NodeLabel> entry : labelCollections.entrySet()) { NodeLabel label = entry.getValue(); infos.add(label.getCopy()); } Collections.sort(infos); return infos; } finally { readLock.unlock(); } } }
RMNodeLabelsManager extends CommonNodeLabelsManager { public List<NodeLabel> pullRMNodeLabelsInfo() { try { readLock.lock(); List<NodeLabel> infos = new ArrayList<NodeLabel>(); for (Entry<String, NodeLabel> entry : labelCollections.entrySet()) { NodeLabel label = entry.getValue(); infos.add(label.getCopy()); } Collections.sort(infos); return infos; } finally { readLock.unlock(); } }  }
RMNodeLabelsManager extends CommonNodeLabelsManager { public List<NodeLabel> pullRMNodeLabelsInfo() { try { readLock.lock(); List<NodeLabel> infos = new ArrayList<NodeLabel>(); for (Entry<String, NodeLabel> entry : labelCollections.entrySet()) { NodeLabel label = entry.getValue(); infos.add(label.getCopy()); } Collections.sort(infos); return infos; } finally { readLock.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); List<NodeLabel> pullRMNodeLabelsInfo(); }
RMNodeLabelsManager extends CommonNodeLabelsManager { public List<NodeLabel> pullRMNodeLabelsInfo() { try { readLock.lock(); List<NodeLabel> infos = new ArrayList<NodeLabel>(); for (Entry<String, NodeLabel> entry : labelCollections.entrySet()) { NodeLabel label = entry.getValue(); infos.add(label.getCopy()); } Collections.sort(infos); return infos; } finally { readLock.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); List<NodeLabel> pullRMNodeLabelsInfo();  }