Class DefaultHttp2RemoteFlowController.FlowState

    • Field Detail

      • window

        private int window
      • pendingBytes

        private long pendingBytes
      • markedWritable

        private boolean markedWritable
      • writing

        private boolean writing
        Set to true while a frame is being written, false otherwise.
      • cancelled

        private boolean cancelled
        Set to true if cancel() was called.
    • Method Detail

      • isWritable

        boolean isWritable()
        Determine if the stream associated with this object is writable.
        Returns:
        true if the stream associated with this object is writable.
      • markedWritability

        void markedWritability​(boolean isWritable)
        Save the state of writability.
      • windowSize

        public int windowSize()
        Description copied from interface: StreamByteDistributor.StreamState
        The size (in bytes) of the stream's flow control window. The amount written must not exceed this amount!

        A StreamByteDistributor needs to know the stream's window size in order to avoid allocating bytes if the window size is negative. The window size being 0 may also be significant to determine when if an stream has been given a chance to write an empty frame, and also enables optimizations like not writing empty frames in some situations (don't write headers until data can also be written).

        Specified by:
        windowSize in interface StreamByteDistributor.StreamState
        Returns:
        the size of the stream's flow control window.
        See Also:
        Http2CodecUtil.streamableBytes(StreamState)
      • windowSize

        void windowSize​(int initialWindowSize)
        Reset the window size for this stream.
      • writeAllocatedBytes

        int writeAllocatedBytes​(int allocated)
        Write the allocated bytes for this stream.
        Returns:
        the number of bytes written for a stream or -1 if no write occurred.
      • incrementStreamWindow

        int incrementStreamWindow​(int delta)
                           throws Http2Exception
        Increments the flow control window for this stream by the given delta and returns the new value.
        Throws:
        Http2Exception
      • writableWindow

        private int writableWindow()
        Returns the maximum writable window (minimum of the stream and connection windows).
      • cancel

        void cancel​(Http2Error error,
                    java.lang.Throwable cause)
        Clears the pending queue and writes errors for each remaining frame.
        Parameters:
        error - the Http2Error to use.
        cause - the Throwable that caused this method to be invoked.
      • incrementPendingBytes

        private void incrementPendingBytes​(int numBytes,
                                           boolean updateStreamableBytes)
        Increments the number of pending bytes for this node and optionally updates the StreamByteDistributor.
      • decrementPendingBytes

        private void decrementPendingBytes​(int bytes,
                                           boolean updateStreamableBytes)
        If this frame is in the pending queue, decrements the number of pending bytes for the stream.
      • decrementFlowControlWindow

        private void decrementFlowControlWindow​(int bytes)
        Decrement the per stream and connection flow control window by bytes.