Class Contexts
java.lang.Object
io.grpc.Contexts
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classImplementation ofForwardingServerCallListenerthat attaches a context before dispatching calls to the delegate and detaches them after the call completes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <ReqT,RespT>
ServerCall.Listener<ReqT> interceptCall(Context context, ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) Make the providedContextContext.current()for the creation of a listener to a received call and for all events received by that listener.static StatusstatusFromCancelled(Context context) Returns theStatusof a cancelled context ornullif the context is not cancelled.
-
Constructor Details
-
Contexts
private Contexts()
-
-
Method Details
-
interceptCall
public static <ReqT,RespT> ServerCall.Listener<ReqT> interceptCall(Context context, ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) Make the providedContextContext.current()for the creation of a listener to a received call and for all events received by that listener.This utility is expected to be used by
ServerInterceptorimplementations that need to augment theContextin which the application does work when receiving events from the client.- Parameters:
context- to makeContext.current().call- used to send responses to client.headers- received from client.next- handler used to create the listener to be wrapped.- Returns:
- listener that will receive events in the scope of the provided context.
-
statusFromCancelled
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1975") public static Status statusFromCancelled(Context context) Returns theStatusof a cancelled context ornullif the context is not cancelled.
-