Class Contexts.ContextualizedServerCallListener<ReqT>
java.lang.Object
io.grpc.ServerCall.Listener<ReqT>
io.grpc.PartialForwardingServerCallListener<ReqT>
io.grpc.ForwardingServerCallListener<ReqT>
io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>
io.grpc.Contexts.ContextualizedServerCallListener<ReqT>
- Enclosing class:
Contexts
private static class Contexts.ContextualizedServerCallListener<ReqT>
extends ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>
Implementation of
ForwardingServerCallListener that attaches a context before
dispatching calls to the delegate and detaches them after the call completes.-
Nested Class Summary
Nested classes/interfaces inherited from class ForwardingServerCallListener
ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionContextualizedServerCallListener(ServerCall.Listener<ReqT> delegate, Context context) -
Method Summary
Modifier and TypeMethodDescriptionvoidonCancel()The call was cancelled and the server is encouraged to abort processing to save resources, since the client will not process any further messages.voidThe call is considered complete andServerCall.Listener.onCancel()is guaranteed not to be called.voidThe client completed all message sending.voidA request message has been received.voidonReady()This indicates that the call may now be capable of sending additional messages (viaServerCall.sendMessage(RespT)) without requiring excessive buffering internally.Methods inherited from class ForwardingServerCallListener.SimpleForwardingServerCallListener
delegateMethods inherited from class PartialForwardingServerCallListener
toString
-
Field Details
-
context
-
-
Constructor Details
-
ContextualizedServerCallListener
-
-
Method Details
-
onMessage
Description copied from class:ServerCall.ListenerA request message has been received. For streaming calls, there may be zero or more request messages.- Overrides:
onMessagein classForwardingServerCallListener<ReqT>- Parameters:
message- a received request message.
-
onHalfClose
public void onHalfClose()Description copied from class:ServerCall.ListenerThe client completed all message sending. However, the call may still be cancelled.- Overrides:
onHalfClosein classPartialForwardingServerCallListener<ReqT>
-
onCancel
public void onCancel()Description copied from class:ServerCall.ListenerThe call was cancelled and the server is encouraged to abort processing to save resources, since the client will not process any further messages. Cancellations can be caused by timeouts, explicit cancellation by the client, network errors, etc.There will be no further callbacks for the call.
- Overrides:
onCancelin classPartialForwardingServerCallListener<ReqT>
-
onComplete
public void onComplete()Description copied from class:ServerCall.ListenerThe call is considered complete andServerCall.Listener.onCancel()is guaranteed not to be called. However, the client is not guaranteed to have received all messages.There will be no further callbacks for the call.
- Overrides:
onCompletein classPartialForwardingServerCallListener<ReqT>
-
onReady
public void onReady()Description copied from class:ServerCall.ListenerThis indicates that the call may now be capable of sending additional messages (viaServerCall.sendMessage(RespT)) without requiring excessive buffering internally. This event is just a suggestion and the application is free to ignore it, however doing so may result in excessive buffering within the call.Because there is a processing delay to deliver this notification, it is possible for concurrent writes to cause
isReady() == falsewithin this callback. Handle "spurious" notifications by checkingisReady()'s current value instead of assuming it is nowtrue. IfisReady() == falsethe normal expectations apply, so there would be anotheronReady()callback.- Overrides:
onReadyin classPartialForwardingServerCallListener<ReqT>
-