@Override public GetAttributesToNodesResponse getAttributesToNodes( GetAttributesToNodesRequest request) throws YarnException, IOException { NodeAttributesManager attributesManager = rmContext.getNodeAttributesManager(); Map<NodeAttributeKey, List<NodeToAttributeValue>> attrToNodesWithStrVal = new HashMap<>(); Map<NodeAttributeKey, Map<String, AttributeValue>> attributesToNodes = attributesManager.getAttributesToNodes(request.getNodeAttributes()); for (Map.Entry<NodeAttributeKey, Map<String, AttributeValue>> attrib : attributesToNodes.entrySet()) { Map<String, AttributeValue> nodesToVal = attrib.getValue(); List<NodeToAttributeValue> nodeToAttrValList = new ArrayList<>(); for (Map.Entry<String, AttributeValue> nodeToVal : nodesToVal .entrySet()) { nodeToAttrValList.add(NodeToAttributeValue .newInstance(nodeToVal.getKey(), nodeToVal.getValue().getValue())); } attrToNodesWithStrVal.put(attrib.getKey(), nodeToAttrValList); } GetAttributesToNodesResponse response = GetAttributesToNodesResponse.newInstance(attrToNodesWithStrVal); return response; }