use of org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.ResourceLocalizationSpecProto in project hadoop by apache.
the class LocalizerHeartbeatResponsePBImpl method initResources.
private void initResources() {
if (this.resourceSpecs != null) {
return;
}
LocalizerHeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder;
List<ResourceLocalizationSpecProto> list = p.getResourcesList();
this.resourceSpecs = new ArrayList<ResourceLocalizationSpec>();
for (ResourceLocalizationSpecProto c : list) {
this.resourceSpecs.add(convertFromProtoFormat(c));
}
}
use of org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.ResourceLocalizationSpecProto in project hadoop by apache.
the class LocalizerHeartbeatResponsePBImpl method addResourcesToProto.
private void addResourcesToProto() {
maybeInitBuilder();
builder.clearResources();
if (this.resourceSpecs == null)
return;
Iterable<ResourceLocalizationSpecProto> iterable = new Iterable<ResourceLocalizationSpecProto>() {
@Override
public Iterator<ResourceLocalizationSpecProto> iterator() {
return new Iterator<ResourceLocalizationSpecProto>() {
Iterator<ResourceLocalizationSpec> iter = resourceSpecs.iterator();
@Override
public boolean hasNext() {
return iter.hasNext();
}
@Override
public ResourceLocalizationSpecProto next() {
ResourceLocalizationSpec resource = iter.next();
return ((ResourceLocalizationSpecPBImpl) resource).getProto();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
};
builder.addAllResources(iterable);
}
Aggregations