Package io.grpc.internal
Class ClientCallImpl.ClientStreamListenerImpl
- java.lang.Object
-
- io.grpc.internal.ClientCallImpl.ClientStreamListenerImpl
-
- All Implemented Interfaces:
ClientStreamListener,StreamListener
- Enclosing class:
- ClientCallImpl<ReqT,RespT>
private class ClientCallImpl.ClientStreamListenerImpl extends java.lang.Object implements ClientStreamListener
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.grpc.internal.ClientStreamListener
ClientStreamListener.RpcProgress
-
Nested classes/interfaces inherited from interface io.grpc.internal.StreamListener
StreamListener.MessageProducer
-
-
Field Summary
Fields Modifier and Type Field Description private StatusexceptionStatusprivate ClientCall.Listener<RespT>observer
-
Constructor Summary
Constructors Constructor Description ClientStreamListenerImpl(ClientCall.Listener<RespT> observer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclosed(Status status, ClientStreamListener.RpcProgress rpcProgress, Metadata trailers)Called when the stream is fully closed.private voidclosedInternal(Status status, ClientStreamListener.RpcProgress rpcProgress, Metadata trailers)private voidexceptionThrown(Status status)Cancels call and schedules onClose() notification.voidheadersRead(Metadata headers)Called upon receiving all header information from the remote end-point.voidmessagesAvailable(StreamListener.MessageProducer producer)Called upon receiving a message from the remote end-point.voidonReady()This indicates that the transport is now capable of sending additional messages without requiring excessive buffering internally.
-
-
-
Field Detail
-
observer
private final ClientCall.Listener<RespT> observer
-
exceptionStatus
private Status exceptionStatus
-
-
Constructor Detail
-
ClientStreamListenerImpl
public ClientStreamListenerImpl(ClientCall.Listener<RespT> observer)
-
-
Method Detail
-
exceptionThrown
private void exceptionThrown(Status status)
Cancels call and schedules onClose() notification. May only be called from the application thread.
-
headersRead
public void headersRead(Metadata headers)
Description copied from interface:ClientStreamListenerCalled upon receiving all header information from the remote end-point. Note that transports are not required to call this method if no header information is received, this would occur when a stream immediately terminates with an error and onlyClientStreamListener.closed(io.grpc.Status, RpcProgress, Metadata)is called.This method should return quickly, as the same thread may be used to process other streams.
- Specified by:
headersReadin interfaceClientStreamListener- Parameters:
headers- the fully buffered received headers.
-
messagesAvailable
public void messagesAvailable(StreamListener.MessageProducer producer)
Description copied from interface:StreamListenerCalled upon receiving a message from the remote end-point.Implementations must eventually drain the provided
producerStreamListener.MessageProducercompletely 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:
messagesAvailablein interfaceStreamListener- Parameters:
producer- supplier of deframed messages.
-
closed
public void closed(Status status, ClientStreamListener.RpcProgress rpcProgress, Metadata trailers)
Description copied from interface:ClientStreamListenerCalled when the stream is fully closed.Status.Code.OKis the only status code that is guaranteed to have been sent from the remote server. Any other status code may have been caused by abnormal stream termination. 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:
closedin interfaceClientStreamListener- Parameters:
status- details about the remote closurerpcProgress- RPC progress when client stream listener is closedtrailers- trailing metadata
-
closedInternal
private void closedInternal(Status status, ClientStreamListener.RpcProgress rpcProgress, Metadata trailers)
-
onReady
public void onReady()
Description copied from interface:StreamListenerThis 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:
onReadyin interfaceStreamListener
-
-