Class TransmitStatusRuntimeExceptionInterceptor
java.lang.Object
io.grpc.util.TransmitStatusRuntimeExceptionInterceptor
- All Implemented Interfaces:
ServerInterceptor
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2189")
public final class TransmitStatusRuntimeExceptionInterceptor
extends Object
implements ServerInterceptor
A class that intercepts uncaught exceptions of type
StatusRuntimeException and handles
them by closing the ServerCall, and transmitting the exception's status and metadata
to the client.
Without this interceptor, gRPC will strip all details and close the ServerCall with
a generic Status.UNKNOWN code.
Security warning: the Status and Metadata may contain sensitive server-side
state information, and generally should not be sent to clients. Only install this interceptor
if all clients are trusted.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classAServerCallthat wraps around a non thread safe delegate and provides thread safe access by serializing everything on an executor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ServerInterceptorinstance()<ReqT,RespT>
ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next)
-
Constructor Details
-
TransmitStatusRuntimeExceptionInterceptor
private TransmitStatusRuntimeExceptionInterceptor()
-
-
Method Details
-
instance
-
interceptCall
public <ReqT,RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) Description copied from interface:ServerInterceptorInterceptServerCalldispatch by thenextServerCallHandler. General semantics ofServerCallHandler.startCall(ServerCall, Metadata)apply and the returnedServerCall.Listenermust not benull.If the implementation throws an exception,
callwill be closed with an error. Implementations must not throw an exception if they started processing that may usecallon another thread.- Specified by:
interceptCallin interfaceServerInterceptor- Parameters:
call- object to receive response messagesheaders- which can contain extra call metadata fromClientCall.start(ClientCall.Listener, Metadata), e.g. authentication credentials.next- next processor in the interceptor chain- Returns:
- listener for processing incoming messages for
call, nevernull.
-