Class AbstractStream.TransportState

java.lang.Object
io.grpc.internal.AbstractStream.TransportState
All Implemented Interfaces:
io.grpc.internal.ApplicationThreadDeframerListener.TransportExecutor, MessageDeframer.Listener
Direct Known Subclasses:
AbstractClientStream.TransportState, AbstractServerStream.TransportState
Enclosing class:
AbstractStream

public abstract static class AbstractStream.TransportState extends Object implements MessageDeframer.Listener
Stream state as used by the transport. This should only be called from the transport thread (except for private interactions with AbstractStream).
  • Field Details

  • Constructor Details

  • Method Details

    • setFullStreamDecompressor

      protected void setFullStreamDecompressor(io.grpc.internal.GzipInflatingBuffer fullStreamDecompressor)
    • listener

      protected abstract StreamListener listener()
      Override this method to provide a stream listener.
    • messagesAvailable

      public void messagesAvailable(StreamListener.MessageProducer producer)
      Description copied from interface: MessageDeframer.Listener
      Called to deliver the next complete message.
      Specified by:
      messagesAvailable in interface MessageDeframer.Listener
      Parameters:
      producer - single message producer wrapping the message.
    • closeDeframer

      protected final void closeDeframer(boolean stopDelivery)
      Closes the deframer and frees any resources. After this method is called, additional calls will have no effect.

      When stopDelivery is false, the deframer will wait to close until any already queued messages have been delivered.

      The deframer will invoke MessageDeframer.Listener.deframerClosed(boolean) upon closing.

      Parameters:
      stopDelivery - interrupt pending deliveries and close immediately
    • deframe

      protected final void deframe(ReadableBuffer frame)
      Called to parse a received frame and attempt delivery of any completed messages. Must be called from the transport thread.
    • requestMessagesFromDeframerForTesting

      public final void requestMessagesFromDeframerForTesting(int numMessages)
      Very rarely used. Prefer stream.request() instead of this; this method is only necessary if a stream is not available.
    • getStatsTraceContext

      public final StatsTraceContext getStatsTraceContext()
    • setDecompressor

      protected final void setDecompressor(Decompressor decompressor)
    • onStreamAllocated

      protected void onStreamAllocated()
      Event handler to be called by the subclass when the stream's headers have passed any connection flow control (i.e., MAX_CONCURRENT_STREAMS). It may call the listener's StreamListener.onReady() handler if appropriate. This must be called from the transport thread, since the listener may be called back directly.
    • onStreamDeallocated

      protected final void onStreamDeallocated()
      Notify that the stream does not exist in a usable state any longer. This causes AbstractStream.isReady() to return false from this point forward.

      This does not generally need to be called explicitly by the transport, as it is handled implicitly by AbstractClientStream and AbstractServerStream.

    • isStreamDeallocated

      protected boolean isStreamDeallocated()
    • onSentBytes

      public final void onSentBytes(int numBytes)
      Event handler to be called by the subclass when a number of bytes has been sent to the remote endpoint. May call back the listener's StreamListener.onReady() handler if appropriate. This must be called from the transport thread, since the listener may be called back directly.
      Parameters:
      numBytes - the number of bytes that were sent.
    • getTransportTracer

      protected TransportTracer getTransportTracer()