Package io.grpc.stub
Class ServerCalls
java.lang.Object
io.grpc.stub.ServerCalls
Utility functions for adapting
ServerCallHandlers to application service implementation,
meant to be used by the generated code.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAdaptor to a bidirectional streaming method.static interfaceAdaptor to a client streaming method.(package private) static classNo-op implementation of StreamObserver.private static final classstatic interfaceAdaptor to a server streaming method.private static interfaceprivate static final classstatic interfaceAdaptor to a unary call method.private static interfaceprivate static final class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <ReqT,RespT>
ServerCallHandler<ReqT, RespT> asyncBidiStreamingCall(ServerCalls.BidiStreamingMethod<ReqT, RespT> method) Creates aServerCallHandlerfor a bidi streaming method of the service.static <ReqT,RespT>
ServerCallHandler<ReqT, RespT> asyncClientStreamingCall(ServerCalls.ClientStreamingMethod<ReqT, RespT> method) Creates aServerCallHandlerfor a client streaming method of the service.static <ReqT,RespT>
ServerCallHandler<ReqT, RespT> asyncServerStreamingCall(ServerCalls.ServerStreamingMethod<ReqT, RespT> method) Creates aServerCallHandlerfor a server streaming method of the service.static <ReqT,RespT>
ServerCallHandler<ReqT, RespT> asyncUnaryCall(ServerCalls.UnaryMethod<ReqT, RespT> method) Creates aServerCallHandlerfor a unary call method of the service.static <ReqT> StreamObserver<ReqT> asyncUnimplementedStreamingCall(MethodDescriptor<?, ?> methodDescriptor, StreamObserver<?> responseObserver) Sets unimplemented status for streaming call.static voidasyncUnimplementedUnaryCall(MethodDescriptor<?, ?> methodDescriptor, StreamObserver<?> responseObserver) Sets unimplemented status for method on given response stream for unary call.
-
Field Details
-
TOO_MANY_REQUESTS
- See Also:
-
MISSING_REQUEST
- See Also:
-
-
Constructor Details
-
ServerCalls
private ServerCalls()
-
-
Method Details
-
asyncUnaryCall
public static <ReqT,RespT> ServerCallHandler<ReqT,RespT> asyncUnaryCall(ServerCalls.UnaryMethod<ReqT, RespT> method) Creates aServerCallHandlerfor a unary call method of the service.- Parameters:
method- an adaptor to the actual method on the service implementation.
-
asyncServerStreamingCall
public static <ReqT,RespT> ServerCallHandler<ReqT,RespT> asyncServerStreamingCall(ServerCalls.ServerStreamingMethod<ReqT, RespT> method) Creates aServerCallHandlerfor a server streaming method of the service.- Parameters:
method- an adaptor to the actual method on the service implementation.
-
asyncClientStreamingCall
public static <ReqT,RespT> ServerCallHandler<ReqT,RespT> asyncClientStreamingCall(ServerCalls.ClientStreamingMethod<ReqT, RespT> method) Creates aServerCallHandlerfor a client streaming method of the service.- Parameters:
method- an adaptor to the actual method on the service implementation.
-
asyncBidiStreamingCall
public static <ReqT,RespT> ServerCallHandler<ReqT,RespT> asyncBidiStreamingCall(ServerCalls.BidiStreamingMethod<ReqT, RespT> method) Creates aServerCallHandlerfor a bidi streaming method of the service.- Parameters:
method- an adaptor to the actual method on the service implementation.
-
asyncUnimplementedUnaryCall
public static void asyncUnimplementedUnaryCall(MethodDescriptor<?, ?> methodDescriptor, StreamObserver<?> responseObserver) Sets unimplemented status for method on given response stream for unary call.- Parameters:
methodDescriptor- of method for which error will be thrown.responseObserver- on which error will be set.
-
asyncUnimplementedStreamingCall
public static <ReqT> StreamObserver<ReqT> asyncUnimplementedStreamingCall(MethodDescriptor<?, ?> methodDescriptor, StreamObserver<?> responseObserver) Sets unimplemented status for streaming call.- Parameters:
methodDescriptor- of method for which error will be thrown.responseObserver- on which error will be set.
-