Package io.grpc.internal
Class ServerCallImpl.ServerStreamListenerImpl<ReqT>
java.lang.Object
io.grpc.internal.ServerCallImpl.ServerStreamListenerImpl<ReqT>
- All Implemented Interfaces:
ServerStreamListener
,StreamListener
- Enclosing class:
ServerCallImpl<ReqT,
RespT>
static final class ServerCallImpl.ServerStreamListenerImpl<ReqT>
extends Object
implements ServerStreamListener
All of these callbacks are assumed to called on an application thread, and the caller is
responsible for handling thrown exceptions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.grpc.internal.StreamListener
StreamListener.MessageProducer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ServerCallImpl
<ReqT, ?> private final Context.CancellableContext
private final ServerCall.Listener
<ReqT> -
Constructor Summary
ConstructorsConstructorDescriptionServerStreamListenerImpl
(ServerCallImpl<ReqT, ?> call, ServerCall.Listener<ReqT> listener, Context.CancellableContext context) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when the stream is fully closed.private void
closedInternal
(Status status) void
Called when the remote side of the transport gracefully closed, indicating the client had no more data to send.void
Called upon receiving a message from the remote end-point.private void
void
onReady()
This indicates that the transport is now capable of sending additional messages without requiring excessive buffering internally.
-
Field Details
-
call
-
listener
-
context
-
-
Constructor Details
-
ServerStreamListenerImpl
public ServerStreamListenerImpl(ServerCallImpl<ReqT, ?> call, ServerCall.Listener<ReqT> listener, Context.CancellableContext context)
-
-
Method Details
-
messagesAvailable
Description copied from interface:StreamListener
Called upon receiving a message from the remote end-point.Implementations must eventually drain the provided
producer
StreamListener.MessageProducer
completely by invokingStreamListener.MessageProducer.next()
to obtain deframed messages until the producer returns null.This method should return quickly, as the same thread may be used to process other streams.
- Specified by:
messagesAvailable
in interfaceStreamListener
- Parameters:
producer
- supplier of deframed messages.
-
messagesAvailableInternal
-
halfClosed
public void halfClosed()Description copied from interface:ServerStreamListener
Called when the remote side of the transport gracefully closed, indicating the client had no more data to send. No further messages will be received on the stream.This method should return quickly, as the same thread may be used to process other streams.
- Specified by:
halfClosed
in interfaceServerStreamListener
-
closed
Description copied from interface:ServerStreamListener
Called when the stream is fully closed. A status code ofStatus.Code.OK
implies normal termination of the stream. Any other value implies abnormal termination. Since clients cannot send status, the passed status is always library-generated and only is concerned with transport-level stream shutdown (the call itself may have had a failing status, but if the stream terminated cleanly with the status appearing to have been sent, then the passed status here would beOK
). This is guaranteed to always be the final call on a listener. No further callbacks will be issued.This method should return quickly, as the same thread may be used to process other streams.
- Specified by:
closed
in interfaceServerStreamListener
- Parameters:
status
- details about the remote closure
-
closedInternal
-
onReady
public void onReady()Description copied from interface:StreamListener
This indicates that the transport is now capable of sending additional messages 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 transport.- Specified by:
onReady
in interfaceStreamListener
-