Class DefaultHttp2RemoteFlowController.WritabilityMonitor

java.lang.Object
io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.WritabilityMonitor
All Implemented Interfaces:
StreamByteDistributor.Writer
Direct Known Subclasses:
DefaultHttp2RemoteFlowController.ListenerWritabilityMonitor
Enclosing class:
DefaultHttp2RemoteFlowController

private class DefaultHttp2RemoteFlowController.WritabilityMonitor extends Object implements StreamByteDistributor.Writer
Abstract class which provides common functionality for writability monitor implementations.
  • Field Details

    • inWritePendingBytes

      private boolean inWritePendingBytes
    • totalPendingBytes

      private long totalPendingBytes
  • Constructor Details

    • WritabilityMonitor

      private WritabilityMonitor()
  • Method Details

    • write

      public final void write(Http2Stream stream, int numBytes)
      Description copied from interface: StreamByteDistributor.Writer
      Writes the allocated bytes for this stream.

      Any Throwable thrown from this method is considered a programming error. A GOAWAY frame will be sent and the will be connection closed.

      Specified by:
      write in interface StreamByteDistributor.Writer
      Parameters:
      stream - the stream for which to perform the write.
      numBytes - the number of bytes to write.
    • channelWritabilityChange

      void channelWritabilityChange() throws Http2Exception
      Called when the writability of the underlying channel changes.
      Throws:
      Http2Exception - If a write occurs and an exception happens in the write operation.
    • stateCancelled

      void stateCancelled(DefaultHttp2RemoteFlowController.FlowState state)
      Called when the state is cancelled.
      Parameters:
      state - the state that was cancelled.
    • windowSize

      void windowSize(DefaultHttp2RemoteFlowController.FlowState state, int initialWindowSize)
      Set the initial window size for state.
      Parameters:
      state - the state to change the initial window size for.
      initialWindowSize - the size of the window in bytes.
    • incrementWindowSize

      void incrementWindowSize(DefaultHttp2RemoteFlowController.FlowState state, int delta) throws Http2Exception
      Increment the window size for a particular stream.
      Parameters:
      state - the state associated with the stream whose window is being incremented.
      delta - The amount to increment by.
      Throws:
      Http2Exception - If this operation overflows the window for state.
    • enqueueFrame

      Add a frame to be sent via flow control.
      Parameters:
      state - The state associated with the stream which the frame is associated with.
      frame - the frame to enqueue.
      Throws:
      Http2Exception - If a writability error occurs.
    • incrementPendingBytes

      final void incrementPendingBytes(int delta)
      Increment the total amount of pending bytes for all streams. When any stream's pending bytes changes method should be called.
      Parameters:
      delta - The amount to increment by.
    • isWritable

      final boolean isWritable(DefaultHttp2RemoteFlowController.FlowState state)
      Determine if the stream associated with state is writable.
      Parameters:
      state - The state which is associated with the stream to test writability for.
      Returns:
      true if DefaultHttp2RemoteFlowController.FlowState.stream() is writable. false otherwise.
    • writePendingBytes

      final void writePendingBytes() throws Http2Exception
      Throws:
      Http2Exception
    • initialWindowSize

      void initialWindowSize(int newWindowSize) throws Http2Exception
      Throws:
      Http2Exception
    • isWritableConnection

      final boolean isWritableConnection()