Class ApplicationThreadDeframer

java.lang.Object
io.grpc.internal.ApplicationThreadDeframer
All Implemented Interfaces:
Deframer

public class ApplicationThreadDeframer extends Object implements Deframer
Sits between AbstractStream.TransportState and MessageDeframer to deframe in the client thread. Calls from the transport to the deframer are wrapped into an ApplicationThreadDeframer.InitializingMessageProducer and given back to the transport, where they will be run on the client thread. Calls from the deframer back to the transport use ApplicationThreadDeframerListener.TransportExecutor.runOnTransportThread(java.lang.Runnable) to run on the transport thread.
  • Method Details

    • setMaxInboundMessageSize

      public void setMaxInboundMessageSize(int messageSize)
      Specified by:
      setMaxInboundMessageSize in interface Deframer
    • setDecompressor

      public void setDecompressor(Decompressor decompressor)
      Description copied from interface: Deframer
      Sets the decompressor available to use. The message encoding for the stream comes later in time, and thus will not be available at the time of construction. This should only be set once, since the compression codec cannot change after the headers have been sent.
      Specified by:
      setDecompressor in interface Deframer
      Parameters:
      decompressor - the decompressing wrapper.
    • setFullStreamDecompressor

      public void setFullStreamDecompressor(io.grpc.internal.GzipInflatingBuffer fullStreamDecompressor)
      Description copied from interface: Deframer
      Sets the decompressor used for full-stream decompression. Full-stream decompression disables any per-message decompressor set by Deframer.setDecompressor(io.grpc.Decompressor).
      Specified by:
      setFullStreamDecompressor in interface Deframer
      Parameters:
      fullStreamDecompressor - the decompressing wrapper
    • request

      public void request(int numMessages)
      Description copied from interface: Deframer
      Requests up to the given number of messages from the call. No additional messages will be delivered.

      If Deframer.close() has been called, this method will have no effect.

      Specified by:
      request in interface Deframer
      Parameters:
      numMessages - the requested number of messages to be delivered to the listener.
    • deframe

      public void deframe(ReadableBuffer data)
      Description copied from interface: Deframer
      Adds the given data to this deframer and attempts delivery to the listener.
      Specified by:
      deframe in interface Deframer
      Parameters:
      data - the raw data read from the remote endpoint. Must be non-null.
    • closeWhenComplete

      public void closeWhenComplete()
      Description copied from interface: Deframer
      Close when any messages currently queued have been requested and delivered.
      Specified by:
      closeWhenComplete in interface Deframer
    • close

      public void close()
      Description copied from interface: Deframer
      Closes this deframer and frees any resources. After this method is called, additional calls will have no effect.
      Specified by:
      close in interface Deframer