Home / Type/ FlowControlled Type — netty Architecture

FlowControlled Type — netty Architecture

Architecture documentation for the FlowControlled type/interface in Http2RemoteFlowController.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3be7e9b8_0377_feff_c69b_57faa042b626["FlowControlled"]
  5592a3f9_f077_ed48_924c_83efa5f7a53b["Http2RemoteFlowController.java"]
  3be7e9b8_0377_feff_c69b_57faa042b626 -->|defined in| 5592a3f9_f077_ed48_924c_83efa5f7a53b
  style 3be7e9b8_0377_feff_c69b_57faa042b626 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2RemoteFlowController.java lines 99–154

    interface FlowControlled {
        /**
         * The size of the payload in terms of bytes applied to the flow-control window.
         * Some payloads like {@code HEADER} frames have no cost against flow control and would
         * return 0 for this value even though they produce a non-zero number of bytes on
         * the wire. Other frames like {@code DATA} frames have both their payload and padding count
         * against flow-control.
         */
        int size();

        /**
         * Called to indicate that an error occurred before this object could be completely written.
         * <p>
         * The {@link Http2RemoteFlowController} will make exactly one call to either
         * this method or {@link #writeComplete()}.
         * </p>
         *
         * @param ctx The context to use if any communication needs to occur as a result of the error.
         * This may be {@code null} if an exception occurs when the connection has not been established yet.
         * @param cause of the error.
         */
        void error(ChannelHandlerContext ctx, Throwable cause);

        /**
         * Called after this object has been successfully written.
         * <p>
         * The {@link Http2RemoteFlowController} will make exactly one call to either
         * this method or {@link #error(ChannelHandlerContext, Throwable)}.
         * </p>
         */
        void writeComplete();

        /**
         * Writes up to {@code allowedBytes} of the encapsulated payload to the stream. Note that
         * a value of 0 may be passed which will allow payloads with flow-control size == 0 to be
         * written. The flow-controller may call this method multiple times with different values until
         * the payload is fully written, i.e it's size after the write is 0.
         * <p>
         * When an exception is thrown the {@link Http2RemoteFlowController} will make a call to
         * {@link #error(ChannelHandlerContext, Throwable)}.
         * </p>
         *
         * @param ctx The context to use for writing.
         * @param allowedBytes an upper bound on the number of bytes the payload can write at this time.
         */
        void write(ChannelHandlerContext ctx, int allowedBytes);

        /**
         * Merge the contents of the {@code next} message into this message so they can be written out as one unit.
         * This allows many small messages to be written as a single DATA frame.
         *
         * @return {@code true} if {@code next} was successfully merged and does not need to be enqueued,
         *     {@code false} otherwise.
         */
        boolean merge(ChannelHandlerContext ctx, FlowControlled next);
    }

Frequently Asked Questions

What is the FlowControlled type?
FlowControlled is a type/interface in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2RemoteFlowController.java.
Where is FlowControlled defined?
FlowControlled is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2RemoteFlowController.java at line 99.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free