Class AbstractH2StreamMultiplexer.H2StreamChannelImpl

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int id  
      private java.util.concurrent.atomic.AtomicInteger inputWindow  
      private boolean localClosed  
      private long localResetTime  
      private java.util.concurrent.atomic.AtomicInteger outputWindow  
    • Constructor Summary

      Constructors 
      Constructor Description
      H2StreamChannelImpl​(int id, int initialInputWindowSize, int initialOutputWindowSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean cancel()
      Cancels the ongoing operation or process.
      void endStream()
      Terminates the underlying data stream and optionally writes a closing sequence.
      void endStream​(java.util.List<? extends Header> trailers)
      Terminates the underlying data stream and optionally writes a closing sequence with the given trailers.
      (package private) void ensureNotClosed()  
      int getId()  
      java.util.concurrent.atomic.AtomicInteger getInputWindow()  
      long getLocalResetTime()  
      java.util.concurrent.atomic.AtomicInteger getOutputWindow()  
      boolean isLocalClosed()  
      boolean localReset​(int code)  
      void markLocalClosed()  
      void push​(java.util.List<Header> headers, AsyncPushProducer pushProducer)  
      void requestOutput()
      Signals intent by the data producer to produce more data.
      void submit​(java.util.List<Header> headers, boolean endStream)  
      java.lang.String toString()  
      void update​(int increment)
      Updates data capacity information through this channel.
      int write​(java.nio.ByteBuffer payload)
      Writes data from the buffer through this channel into the underlying byte stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • id

        private final int id
      • inputWindow

        private final java.util.concurrent.atomic.AtomicInteger inputWindow
      • outputWindow

        private final java.util.concurrent.atomic.AtomicInteger outputWindow
      • localClosed

        private volatile boolean localClosed
      • localResetTime

        private volatile long localResetTime
    • Constructor Detail

      • H2StreamChannelImpl

        H2StreamChannelImpl​(int id,
                            int initialInputWindowSize,
                            int initialOutputWindowSize)
    • Method Detail

      • submit

        public void submit​(java.util.List<Header> headers,
                           boolean endStream)
                    throws java.io.IOException
        Specified by:
        submit in interface H2StreamChannel
        Throws:
        java.io.IOException
      • update

        public void update​(int increment)
                    throws java.io.IOException
        Description copied from interface: CapacityChannel
        Updates data capacity information through this channel. The total number of bytes the consumer is capable of accepting is incremented by the given increment number.
        Specified by:
        update in interface CapacityChannel
        Parameters:
        increment - non-negative number of extra bytes the consumer can accept.
        Throws:
        java.io.IOException - in case of an I/O error.
      • write

        public int write​(java.nio.ByteBuffer payload)
                  throws java.io.IOException
        Description copied from interface: DataStreamChannel
        Writes data from the buffer through this channel into the underlying byte stream. If the underlying byte stream is temporarily unable to accept more data it can return zero to indicate that no data could be written to the data stream. The data producer can choose to call DataStreamChannel.requestOutput() to signal its intent to produce more data.
        Specified by:
        write in interface DataStreamChannel
        Specified by:
        write in interface StreamChannel<java.nio.ByteBuffer>
        Parameters:
        payload - source of data
        Returns:
        The number of bytes written, possibly zero
        Throws:
        java.io.IOException - in case of an I/O error.
      • endStream

        public void endStream​(java.util.List<? extends Header> trailers)
                       throws java.io.IOException
        Description copied from interface: DataStreamChannel
        Terminates the underlying data stream and optionally writes a closing sequence with the given trailers.

        Please note that some data streams may not support trailers and may silently ignore the trailers parameter.

        Specified by:
        endStream in interface DataStreamChannel
        Throws:
        java.io.IOException - in case of an I/O error.
      • endStream

        public void endStream()
                       throws java.io.IOException
        Description copied from interface: StreamChannel
        Terminates the underlying data stream and optionally writes a closing sequence.
        Specified by:
        endStream in interface StreamChannel<java.nio.ByteBuffer>
        Throws:
        java.io.IOException - in case of an I/O error.
      • requestOutput

        public void requestOutput()
        Description copied from interface: DataStreamChannel
        Signals intent by the data producer to produce more data. Once the channel is able to accept data its handler is expected to trigger an event to notify the data producer.
        Specified by:
        requestOutput in interface DataStreamChannel
      • localReset

        public boolean localReset​(int code)
                           throws java.io.IOException
        Specified by:
        localReset in interface H2StreamChannel
        Throws:
        java.io.IOException
      • cancel

        public boolean cancel()
        Description copied from interface: Cancellable
        Cancels the ongoing operation or process.
        Specified by:
        cancel in interface Cancellable
        Returns:
        true if the operation or process has been cancelled as a result of this method call or false if it has already been cancelled or not started.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object