Search in sources :

Example 1 with GenericRefreshResponseCollectionProto

use of org.apache.hadoop.ipc.proto.GenericRefreshProtocolProtos.GenericRefreshResponseCollectionProto in project hadoop by apache.

the class GenericRefreshProtocolClientSideTranslatorPB method refresh.

@Override
public Collection<RefreshResponse> refresh(String identifier, String[] args) throws IOException {
    List<String> argList = Arrays.asList(args);
    try {
        GenericRefreshRequestProto request = GenericRefreshRequestProto.newBuilder().setIdentifier(identifier).addAllArgs(argList).build();
        GenericRefreshResponseCollectionProto resp = rpcProxy.refresh(NULL_CONTROLLER, request);
        return unpack(resp);
    } catch (ServiceException se) {
        throw ProtobufHelper.getRemoteException(se);
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) GenericRefreshRequestProto(org.apache.hadoop.ipc.proto.GenericRefreshProtocolProtos.GenericRefreshRequestProto) GenericRefreshResponseCollectionProto(org.apache.hadoop.ipc.proto.GenericRefreshProtocolProtos.GenericRefreshResponseCollectionProto)

Example 2 with GenericRefreshResponseCollectionProto

use of org.apache.hadoop.ipc.proto.GenericRefreshProtocolProtos.GenericRefreshResponseCollectionProto in project hadoop by apache.

the class GenericRefreshProtocolServerSideTranslatorPB method pack.

// Convert a collection of RefreshResponse objects to a
// RefreshResponseCollection proto
private GenericRefreshResponseCollectionProto pack(Collection<RefreshResponse> responses) {
    GenericRefreshResponseCollectionProto.Builder b = GenericRefreshResponseCollectionProto.newBuilder();
    for (RefreshResponse response : responses) {
        GenericRefreshResponseProto.Builder respBuilder = GenericRefreshResponseProto.newBuilder();
        respBuilder.setExitStatus(response.getReturnCode());
        respBuilder.setUserMessage(response.getMessage());
        respBuilder.setSenderName(response.getSenderName());
        // Add to collection
        b.addResponses(respBuilder);
    }
    return b.build();
}
Also used : RefreshResponse(org.apache.hadoop.ipc.RefreshResponse) GenericRefreshResponseProto(org.apache.hadoop.ipc.proto.GenericRefreshProtocolProtos.GenericRefreshResponseProto) GenericRefreshResponseCollectionProto(org.apache.hadoop.ipc.proto.GenericRefreshProtocolProtos.GenericRefreshResponseCollectionProto)

Aggregations

GenericRefreshResponseCollectionProto (org.apache.hadoop.ipc.proto.GenericRefreshProtocolProtos.GenericRefreshResponseCollectionProto)2 ServiceException (com.google.protobuf.ServiceException)1 RefreshResponse (org.apache.hadoop.ipc.RefreshResponse)1 GenericRefreshRequestProto (org.apache.hadoop.ipc.proto.GenericRefreshProtocolProtos.GenericRefreshRequestProto)1 GenericRefreshResponseProto (org.apache.hadoop.ipc.proto.GenericRefreshProtocolProtos.GenericRefreshResponseProto)1