Search in sources :

Example 1 with GetProtocolVersionsResponseProto

use of org.apache.hadoop.ipc.protobuf.ProtocolInfoProtos.GetProtocolVersionsResponseProto in project hadoop by apache.

the class ProtocolMetaInfoServerSideTranslatorPB method getProtocolVersions.

@Override
public GetProtocolVersionsResponseProto getProtocolVersions(RpcController controller, GetProtocolVersionsRequestProto request) throws ServiceException {
    String protocol = request.getProtocol();
    GetProtocolVersionsResponseProto.Builder builder = GetProtocolVersionsResponseProto.newBuilder();
    for (RPC.RpcKind r : RPC.RpcKind.values()) {
        long[] versions;
        try {
            versions = getProtocolVersionForRpcKind(r, protocol);
        } catch (ClassNotFoundException e) {
            throw new ServiceException(e);
        }
        ProtocolVersionProto.Builder b = ProtocolVersionProto.newBuilder();
        if (versions != null) {
            b.setRpcKind(r.toString());
            for (long v : versions) {
                b.addVersions(v);
            }
        }
        builder.addProtocolVersions(b.build());
    }
    return builder.build();
}
Also used : ServiceException(com.google.protobuf.ServiceException) ProtocolVersionProto(org.apache.hadoop.ipc.protobuf.ProtocolInfoProtos.ProtocolVersionProto) GetProtocolVersionsResponseProto(org.apache.hadoop.ipc.protobuf.ProtocolInfoProtos.GetProtocolVersionsResponseProto)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 GetProtocolVersionsResponseProto (org.apache.hadoop.ipc.protobuf.ProtocolInfoProtos.GetProtocolVersionsResponseProto)1 ProtocolVersionProto (org.apache.hadoop.ipc.protobuf.ProtocolInfoProtos.ProtocolVersionProto)1