use of org.apache.hadoop.yarn.proto.YarnProtos.StringBytesMapProto in project hadoop by apache.
the class StartContainersResponsePBImpl method addServicesMetaDataToProto.
private void addServicesMetaDataToProto() {
maybeInitBuilder();
builder.clearServicesMetaData();
if (servicesMetaData == null)
return;
Iterable<StringBytesMapProto> iterable = new Iterable<StringBytesMapProto>() {
@Override
public Iterator<StringBytesMapProto> iterator() {
return new Iterator<StringBytesMapProto>() {
Iterator<String> keyIter = servicesMetaData.keySet().iterator();
@Override
public void remove() {
throw new UnsupportedOperationException();
}
@Override
public StringBytesMapProto next() {
String key = keyIter.next();
return StringBytesMapProto.newBuilder().setKey(key).setValue(convertToProtoFormat(servicesMetaData.get(key))).build();
}
@Override
public boolean hasNext() {
return keyIter.hasNext();
}
};
}
};
builder.addAllServicesMetaData(iterable);
}
use of org.apache.hadoop.yarn.proto.YarnProtos.StringBytesMapProto in project hadoop by apache.
the class StartContainersResponsePBImpl method initServicesMetaData.
private void initServicesMetaData() {
if (this.servicesMetaData != null) {
return;
}
StartContainersResponseProtoOrBuilder p = viaProto ? proto : builder;
List<StringBytesMapProto> list = p.getServicesMetaDataList();
this.servicesMetaData = new HashMap<String, ByteBuffer>();
for (StringBytesMapProto c : list) {
this.servicesMetaData.put(c.getKey(), convertFromProtoFormat(c.getValue()));
}
}
use of org.apache.hadoop.yarn.proto.YarnProtos.StringBytesMapProto in project hadoop by apache.
the class ContainerLaunchContextPBImpl method addServiceDataToProto.
private void addServiceDataToProto() {
maybeInitBuilder();
builder.clearServiceData();
if (serviceData == null)
return;
Iterable<StringBytesMapProto> iterable = new Iterable<StringBytesMapProto>() {
@Override
public Iterator<StringBytesMapProto> iterator() {
return new Iterator<StringBytesMapProto>() {
Iterator<String> keyIter = serviceData.keySet().iterator();
@Override
public void remove() {
throw new UnsupportedOperationException();
}
@Override
public StringBytesMapProto next() {
String key = keyIter.next();
return StringBytesMapProto.newBuilder().setKey(key).setValue(convertToProtoFormat(serviceData.get(key))).build();
}
@Override
public boolean hasNext() {
return keyIter.hasNext();
}
};
}
};
builder.addAllServiceData(iterable);
}
use of org.apache.hadoop.yarn.proto.YarnProtos.StringBytesMapProto in project hadoop by apache.
the class ContainerLaunchContextPBImpl method initServiceData.
private void initServiceData() {
if (this.serviceData != null) {
return;
}
ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder;
List<StringBytesMapProto> list = p.getServiceDataList();
this.serviceData = new HashMap<String, ByteBuffer>();
for (StringBytesMapProto c : list) {
this.serviceData.put(c.getKey(), convertFromProtoFormat(c.getValue()));
}
}
Aggregations