Home / Type/ FlushStrategy Type — netty Architecture

FlushStrategy Type — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  1b38e30d_be0f_f5a9_aa79_df13f6694515["FlushStrategy"]
  912c1423_c98d_ccd6_9b5f_c987b6e075f8["FlushStrategy.java"]
  1b38e30d_be0f_f5a9_aa79_df13f6694515 -->|defined in| 912c1423_c98d_ccd6_9b5f_c987b6e075f8
  style 1b38e30d_be0f_f5a9_aa79_df13f6694515 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/FlushStrategy.java lines 23–60

public interface FlushStrategy {

    /**
     * Default {@link FlushStrategy} implementation.
     */
    FlushStrategy DEFAULT = afterNumBytes(20 * Quic.MAX_DATAGRAM_SIZE);

    /**
     * Returns {@code true} if a flush should happen now, {@code false} otherwise.
     *
     * @param numPackets    the number of packets that were written since the last flush.
     * @param numBytes      the number of bytes that were written since the last flush.
     * @return              {@code true} if a flush should be done now, {@code false} otherwise.
     */
    boolean shouldFlushNow(int numPackets, int numBytes);

    /**
     * Implementation that flushes after a number of bytes.
     *
     * @param bytes the number of bytes after which we should issue a flush.
     * @return the {@link FlushStrategy}.
     */
    static FlushStrategy afterNumBytes(int bytes) {
        ObjectUtil.checkPositive(bytes, "bytes");
        return (numPackets, numBytes) -> numBytes > bytes;
    }

    /**
     * Implementation that flushes after a number of packets.
     *
     * @param packets the number of packets after which we should issue a flush.
     * @return the {@link FlushStrategy}.
     */
    static FlushStrategy afterNumPackets(int packets) {
        ObjectUtil.checkPositive(packets, "packets");
        return (numPackets, numBytes) -> numPackets > packets;
    }
}

Frequently Asked Questions

What is the FlushStrategy type?
FlushStrategy is a type/interface in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/FlushStrategy.java.
Where is FlushStrategy defined?
FlushStrategy is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/FlushStrategy.java at line 23.

Analyze Your Own Codebase

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

Try Supermodel Free