use of org.apache.hadoop.yarn.server.nodemanager.api.impl.pb.ResourceLocalizationSpecPBImpl 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