Package io.grpc.stub
Class ServerCalls
- java.lang.Object
-
- io.grpc.stub.ServerCalls
-
public final class ServerCalls extends java.lang.Object
Utility functions for adaptingServerCallHandler
s to application service implementation, meant to be used by the generated code.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ServerCalls.BidiStreamingMethod<ReqT,RespT>
Adaptor to a bidirectional streaming method.static interface
ServerCalls.ClientStreamingMethod<ReqT,RespT>
Adaptor to a client streaming method.(package private) static class
ServerCalls.NoopStreamObserver<V>
No-op implementation of StreamObserver.private static class
ServerCalls.ServerCallStreamObserverImpl<ReqT,RespT>
static interface
ServerCalls.ServerStreamingMethod<ReqT,RespT>
Adaptor to a server streaming method.private static interface
ServerCalls.StreamingRequestMethod<ReqT,RespT>
private static class
ServerCalls.StreamingServerCallHandler<ReqT,RespT>
static interface
ServerCalls.UnaryMethod<ReqT,RespT>
Adaptor to a unary call method.private static interface
ServerCalls.UnaryRequestMethod<ReqT,RespT>
private static class
ServerCalls.UnaryServerCallHandler<ReqT,RespT>
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
MISSING_REQUEST
(package private) static java.lang.String
TOO_MANY_REQUESTS
-
Constructor Summary
Constructors Modifier Constructor Description private
ServerCalls()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <ReqT,RespT>
ServerCallHandler<ReqT,RespT>asyncBidiStreamingCall(ServerCalls.BidiStreamingMethod<ReqT,RespT> method)
Creates aServerCallHandler
for a bidi streaming method of the service.static <ReqT,RespT>
ServerCallHandler<ReqT,RespT>asyncClientStreamingCall(ServerCalls.ClientStreamingMethod<ReqT,RespT> method)
Creates aServerCallHandler
for a client streaming method of the service.static <ReqT,RespT>
ServerCallHandler<ReqT,RespT>asyncServerStreamingCall(ServerCalls.ServerStreamingMethod<ReqT,RespT> method)
Creates aServerCallHandler
for a server streaming method of the service.static <ReqT,RespT>
ServerCallHandler<ReqT,RespT>asyncUnaryCall(ServerCalls.UnaryMethod<ReqT,RespT> method)
Creates aServerCallHandler
for a unary call method of the service.static <ReqT> StreamObserver<ReqT>
asyncUnimplementedStreamingCall(MethodDescriptor<?,?> methodDescriptor, StreamObserver<?> responseObserver)
Sets unimplemented status for streaming call.static void
asyncUnimplementedUnaryCall(MethodDescriptor<?,?> methodDescriptor, StreamObserver<?> responseObserver)
Sets unimplemented status for method on given response stream for unary call.
-
-
-
Field Detail
-
TOO_MANY_REQUESTS
static final java.lang.String TOO_MANY_REQUESTS
- See Also:
- Constant Field Values
-
MISSING_REQUEST
static final java.lang.String MISSING_REQUEST
- See Also:
- Constant Field Values
-
-
Method Detail
-
asyncUnaryCall
public static <ReqT,RespT> ServerCallHandler<ReqT,RespT> asyncUnaryCall(ServerCalls.UnaryMethod<ReqT,RespT> method)
Creates aServerCallHandler
for 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 aServerCallHandler
for 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 aServerCallHandler
for 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 aServerCallHandler
for 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.
-
-