Package io.grpc.testing.integration
Class TestServiceImpl
- java.lang.Object
-
- io.grpc.testing.integration.TestServiceImpl
-
- All Implemented Interfaces:
io.grpc.BindableService,TestServiceGrpc.AsyncService
public class TestServiceImpl extends java.lang.Object implements io.grpc.BindableService, TestServiceGrpc.AsyncService
Implementation of the business logic for the TestService. Uses an executor to schedule chunks sent in response streams.
-
-
Constructor Summary
Constructors Constructor Description TestServiceImpl(java.util.concurrent.ScheduledExecutorService executor)TestServiceImpl(java.util.concurrent.ScheduledExecutorService executor, io.grpc.services.MetricRecorder metricRecorder)Constructs a controller using the given executor for scheduling response stream chunks.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.grpc.ServerServiceDefinitionbindService()voidemptyCall(EmptyProtos.Empty request, io.grpc.stub.StreamObserver<EmptyProtos.Empty> responseObserver)One empty request followed by one empty response.io.grpc.stub.StreamObserver<Messages.StreamingOutputCallRequest>fullDuplexCall(io.grpc.stub.StreamObserver<Messages.StreamingOutputCallResponse> responseObserver)True bi-directional streaming.io.grpc.stub.StreamObserver<Messages.StreamingOutputCallRequest>halfDuplexCall(io.grpc.stub.StreamObserver<Messages.StreamingOutputCallResponse> responseObserver)Similar tofullDuplexCall(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse>), except that it waits for all streaming requests to be received before starting the streaming responses.static java.util.List<io.grpc.ServerInterceptor>interceptors()Returns interceptors necessary for full service implementation.io.grpc.stub.StreamObserver<Messages.StreamingInputCallRequest>streamingInputCall(io.grpc.stub.StreamObserver<Messages.StreamingInputCallResponse> responseObserver)Waits until we have received all of the request messages and then returns the aggregate payload size for all of the received requests.voidstreamingOutputCall(Messages.StreamingOutputCallRequest request, io.grpc.stub.StreamObserver<Messages.StreamingOutputCallResponse> responseObserver)Given a request that specifies chunk size and interval between responses, creates and schedules the response stream.java.util.Queue<io.grpc.testing.integration.TestServiceImpl.Chunk>toChunkQueue(Messages.StreamingOutputCallRequest request)Breaks down the request and creates a queue of response chunks for the given request.voidunaryCall(Messages.SimpleRequest req, io.grpc.stub.StreamObserver<Messages.SimpleResponse> responseObserver)Immediately responds with a payload of the type and size specified in the request.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.grpc.testing.integration.TestServiceGrpc.AsyncService
cacheableUnaryCall, unimplementedCall
-
-
-
-
Constructor Detail
-
TestServiceImpl
public TestServiceImpl(java.util.concurrent.ScheduledExecutorService executor, io.grpc.services.MetricRecorder metricRecorder)Constructs a controller using the given executor for scheduling response stream chunks.
-
TestServiceImpl
public TestServiceImpl(java.util.concurrent.ScheduledExecutorService executor)
-
-
Method Detail
-
bindService
public final io.grpc.ServerServiceDefinition bindService()
- Specified by:
bindServicein interfaceio.grpc.BindableService
-
emptyCall
public void emptyCall(EmptyProtos.Empty request, io.grpc.stub.StreamObserver<EmptyProtos.Empty> responseObserver)
Description copied from interface:TestServiceGrpc.AsyncServiceOne empty request followed by one empty response.
- Specified by:
emptyCallin interfaceTestServiceGrpc.AsyncService
-
unaryCall
public void unaryCall(Messages.SimpleRequest req, io.grpc.stub.StreamObserver<Messages.SimpleResponse> responseObserver)
Immediately responds with a payload of the type and size specified in the request.- Specified by:
unaryCallin interfaceTestServiceGrpc.AsyncService
-
streamingOutputCall
public void streamingOutputCall(Messages.StreamingOutputCallRequest request, io.grpc.stub.StreamObserver<Messages.StreamingOutputCallResponse> responseObserver)
Given a request that specifies chunk size and interval between responses, creates and schedules the response stream.- Specified by:
streamingOutputCallin interfaceTestServiceGrpc.AsyncService
-
streamingInputCall
public io.grpc.stub.StreamObserver<Messages.StreamingInputCallRequest> streamingInputCall(io.grpc.stub.StreamObserver<Messages.StreamingInputCallResponse> responseObserver)
Waits until we have received all of the request messages and then returns the aggregate payload size for all of the received requests.- Specified by:
streamingInputCallin interfaceTestServiceGrpc.AsyncService
-
fullDuplexCall
public io.grpc.stub.StreamObserver<Messages.StreamingOutputCallRequest> fullDuplexCall(io.grpc.stub.StreamObserver<Messages.StreamingOutputCallResponse> responseObserver)
True bi-directional streaming. Processes requests as they come in. Begins streaming results immediately.- Specified by:
fullDuplexCallin interfaceTestServiceGrpc.AsyncService
-
halfDuplexCall
public io.grpc.stub.StreamObserver<Messages.StreamingOutputCallRequest> halfDuplexCall(io.grpc.stub.StreamObserver<Messages.StreamingOutputCallResponse> responseObserver)
Similar tofullDuplexCall(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.StreamingOutputCallResponse>), except that it waits for all streaming requests to be received before starting the streaming responses.- Specified by:
halfDuplexCallin interfaceTestServiceGrpc.AsyncService
-
toChunkQueue
public java.util.Queue<io.grpc.testing.integration.TestServiceImpl.Chunk> toChunkQueue(Messages.StreamingOutputCallRequest request)
Breaks down the request and creates a queue of response chunks for the given request.
-
interceptors
public static java.util.List<io.grpc.ServerInterceptor> interceptors()
Returns interceptors necessary for full service implementation.
-
-