Search in sources :

Example 1 with Builder

use of org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetBlockLocationsResponseProto.Builder in project hadoop by apache.

the class ClientNamenodeProtocolServerSideTranslatorPB method getBlockLocations.

@Override
public GetBlockLocationsResponseProto getBlockLocations(RpcController controller, GetBlockLocationsRequestProto req) throws ServiceException {
    try {
        LocatedBlocks b = server.getBlockLocations(req.getSrc(), req.getOffset(), req.getLength());
        Builder builder = GetBlockLocationsResponseProto.newBuilder();
        if (b != null) {
            builder.setLocations(PBHelperClient.convert(b)).build();
        }
        return builder.build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) LocatedBlocks(org.apache.hadoop.hdfs.protocol.LocatedBlocks) Builder(org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetBlockLocationsResponseProto.Builder) IOException(java.io.IOException)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 IOException (java.io.IOException)1 LocatedBlocks (org.apache.hadoop.hdfs.protocol.LocatedBlocks)1 Builder (org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetBlockLocationsResponseProto.Builder)1