Search in sources :

Example 1 with SpeedTestResponse

use of alluxio.hub.proto.SpeedTestResponse in project alluxio by Alluxio.

the class ManagerProcessContext method startSpeedTestListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} SpeedTest RPC calls.
 */
public void startSpeedTestListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<SpeedTestRequest, SpeedTestResponse>() {

        @Override
        public SpeedTestResponse exec(SpeedTestRequest req) {
            return SpeedTestResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(speedTest(req)).build();
        }

        @Override
        public void restart() {
            startSpeedTestListener();
        }

        @Override
        public void handleError(String message, Throwable t) {
            handleStatusRuntimeException(message, t);
        }
    };
    StreamObserver<SpeedTestResponse> responseObserver = asyncStub.speedTest(requestObserver);
    requestObserver.start(responseObserver, SpeedTestResponse.newBuilder().setHubMetadata(mHubMetadata).build());
    LOG.info("Started SpeedTest async listener", asyncStub);
}
Also used : SpeedTestResponse(alluxio.hub.proto.SpeedTestResponse) RequestStreamObserver(alluxio.hub.manager.rpc.observer.RequestStreamObserver) SpeedTestRequest(alluxio.hub.proto.SpeedTestRequest) HostedManagerServiceGrpc(alluxio.hub.proto.HostedManagerServiceGrpc) ByteString(com.google.protobuf.ByteString)

Aggregations

RequestStreamObserver (alluxio.hub.manager.rpc.observer.RequestStreamObserver)1 HostedManagerServiceGrpc (alluxio.hub.proto.HostedManagerServiceGrpc)1 SpeedTestRequest (alluxio.hub.proto.SpeedTestRequest)1 SpeedTestResponse (alluxio.hub.proto.SpeedTestResponse)1 ByteString (com.google.protobuf.ByteString)1