Search in sources :

Example 1 with StringBytesMapProto

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);
}
Also used : StringBytesMapProto(org.apache.hadoop.yarn.proto.YarnProtos.StringBytesMapProto) Iterator(java.util.Iterator) ByteString(com.google.protobuf.ByteString)

Example 2 with StringBytesMapProto

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()));
    }
}
Also used : StartContainersResponseProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnServiceProtos.StartContainersResponseProtoOrBuilder) StringBytesMapProto(org.apache.hadoop.yarn.proto.YarnProtos.StringBytesMapProto) ByteString(com.google.protobuf.ByteString) ByteBuffer(java.nio.ByteBuffer)

Example 3 with StringBytesMapProto

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);
}
Also used : StringBytesMapProto(org.apache.hadoop.yarn.proto.YarnProtos.StringBytesMapProto) Iterator(java.util.Iterator) ByteString(com.google.protobuf.ByteString)

Example 4 with StringBytesMapProto

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()));
    }
}
Also used : StringBytesMapProto(org.apache.hadoop.yarn.proto.YarnProtos.StringBytesMapProto) ByteString(com.google.protobuf.ByteString) ByteBuffer(java.nio.ByteBuffer) ContainerLaunchContextProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnProtos.ContainerLaunchContextProtoOrBuilder)

Aggregations

ByteString (com.google.protobuf.ByteString)4 StringBytesMapProto (org.apache.hadoop.yarn.proto.YarnProtos.StringBytesMapProto)4 ByteBuffer (java.nio.ByteBuffer)2 Iterator (java.util.Iterator)2 ContainerLaunchContextProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnProtos.ContainerLaunchContextProtoOrBuilder)1 StartContainersResponseProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServiceProtos.StartContainersResponseProtoOrBuilder)1