@ThreadSafe public interface ServerInterceptor
ServerCallHandler
.
Implementers use this mechanism to add cross-cutting behavior to server-side calls. Common example of such behavior include:
The interceptor may be called for multiple calls
by one or more threads
without completing the previous ones first. Refer to the
ServerCall.Listener
docs for more details regarding thread
safety of the returned listener.
Modifier and Type | Method and Description |
---|---|
<ReqT,RespT> |
interceptCall(ServerCall<ReqT,RespT> call,
Metadata headers,
ServerCallHandler<ReqT,RespT> next)
|
<ReqT,RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT,RespT> call, Metadata headers, ServerCallHandler<ReqT,RespT> next)
ServerCall
dispatch by the next
ServerCallHandler
. General
semantics of ServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
apply and the returned
ServerCall.Listener
must not be null
.
If the implementation throws an exception, call
will be closed with an error.
Implementations must not throw an exception if they started processing that may use call
on another thread.
call
- object to receive response messagesheaders
- which can contain extra call metadata from ClientCall.start(io.grpc.ClientCall.Listener<RespT>, io.grpc.Metadata)
,
e.g. authentication credentials.next
- next processor in the interceptor chaincall
, never null
.