Class ServerInterceptors.InterceptCallHandler<ReqT,RespT>
- All Implemented Interfaces:
ServerCallHandler<ReqT,
RespT>
- Enclosing class:
ServerInterceptors
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ServerCallHandler
<ReqT, RespT> private final ServerInterceptor
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
InterceptCallHandler
(ServerInterceptor interceptor, ServerCallHandler<ReqT, RespT> callHandler) -
Method Summary
Modifier and TypeMethodDescriptionstatic <ReqT,
RespT>
ServerInterceptors.InterceptCallHandler<ReqT, RespT> create
(ServerInterceptor interceptor, ServerCallHandler<ReqT, RespT> callHandler) startCall
(ServerCall<ReqT, RespT> call, Metadata headers) Starts asynchronous processing of an incoming call.
-
Field Details
-
interceptor
-
callHandler
-
-
Constructor Details
-
InterceptCallHandler
private InterceptCallHandler(ServerInterceptor interceptor, ServerCallHandler<ReqT, RespT> callHandler)
-
-
Method Details
-
create
public static <ReqT,RespT> ServerInterceptors.InterceptCallHandler<ReqT,RespT> create(ServerInterceptor interceptor, ServerCallHandler<ReqT, RespT> callHandler) -
startCall
Description copied from interface:ServerCallHandler
Starts asynchronous processing of an incoming call.Callers of this method transfer their ownership of the non-thread-safe
ServerCall
andMetadata
arguments to theServerCallHandler
implementation for processing. Ownership means that the implementation may invoke methods oncall
andheaders
whileServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
runs and at any time after it returns normally. On the other hand, ifServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
throws, ownership ofcall
andheaders
reverts to the caller and the implementation loses the right to call methods on these objects (from some other thread, say).Ownership also includes the responsibility to eventually close
call
. In particular, ifServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
throws an exception, the caller must handle it by closingcall
with an error. Sincecall
can only be closed once, an implementation can report errors either toServerCall.close(io.grpc.Status, io.grpc.Metadata)
for itself or by throwing an exception, but not both.Returns a non-
null
listener for the incoming call. Callers of this method must arrange for events associated withcall
to be delivered there.- Specified by:
startCall
in interfaceServerCallHandler<ReqT,
RespT> - Parameters:
call
- object for responding to the remote client.headers
- request headers received from the client but open to modification by an owner- Returns:
- listener for processing incoming request messages for
call
-