本文整理汇总了Java中org.apache.hadoop.yarn.proto.YarnProtos.NodeResourceMapProto类的典型用法代码示例。如果您正苦于以下问题:Java NodeResourceMapProto类的具体用法?Java NodeResourceMapProto怎么用?Java NodeResourceMapProto使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeResourceMapProto类属于org.apache.hadoop.yarn.proto.YarnProtos包,在下文中一共展示了NodeResourceMapProto类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initNodeResourceMap
import org.apache.hadoop.yarn.proto.YarnProtos.NodeResourceMapProto; //导入依赖的package包/类
private void initNodeResourceMap() {
if (this.nodeResourceMap != null) {
return;
}
UpdateNodeResourceRequestProtoOrBuilder p = viaProto ? proto : builder;
List<NodeResourceMapProto> list = p.getNodeResourceMapList();
this.nodeResourceMap = new HashMap<NodeId, ResourceOption>(list
.size());
for (NodeResourceMapProto nodeResourceProto : list) {
this.nodeResourceMap.put(convertFromProtoFormat(nodeResourceProto.getNodeId()),
convertFromProtoFormat(nodeResourceProto.getResourceOption()));
}
}
示例2: addNodeResourceMap
import org.apache.hadoop.yarn.proto.YarnProtos.NodeResourceMapProto; //导入依赖的package包/类
private void addNodeResourceMap() {
maybeInitBuilder();
builder.clearNodeResourceMap();
if (nodeResourceMap == null) {
return;
}
Iterable<? extends NodeResourceMapProto> values
= new Iterable<NodeResourceMapProto>() {
@Override
public Iterator<NodeResourceMapProto> iterator() {
return new Iterator<NodeResourceMapProto>() {
Iterator<NodeId> nodeIterator = nodeResourceMap
.keySet().iterator();
@Override
public boolean hasNext() {
return nodeIterator.hasNext();
}
@Override
public NodeResourceMapProto next() {
NodeId nodeId = nodeIterator.next();
return NodeResourceMapProto.newBuilder().setNodeId(
convertToProtoFormat(nodeId)).setResourceOption(
convertToProtoFormat(nodeResourceMap.get(nodeId))).build();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
};
this.builder.addAllNodeResourceMap(values);
}