Home / Class/ Http2SettingsHandler Class — netty Architecture

Http2SettingsHandler Class — netty Architecture

Architecture documentation for the Http2SettingsHandler class in Http2SettingsHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e6d1b4f0_4504_7033_9b12_8cc050126b17["Http2SettingsHandler"]
  0aba84fe_18e4_2008_868c_cb1ca9cae936["Http2SettingsHandler.java"]
  e6d1b4f0_4504_7033_9b12_8cc050126b17 -->|defined in| 0aba84fe_18e4_2008_868c_cb1ca9cae936
  8faf5c47_0f8e_b487_929d_dd69cd952b7b["Http2SettingsHandler()"]
  e6d1b4f0_4504_7033_9b12_8cc050126b17 -->|method| 8faf5c47_0f8e_b487_929d_dd69cd952b7b
  26516a05_d929_8080_14f1_9b302714ca6a["awaitSettings()"]
  e6d1b4f0_4504_7033_9b12_8cc050126b17 -->|method| 26516a05_d929_8080_14f1_9b302714ca6a
  ed90f4ad_a5d2_c547_1aac_11625a7ffa30["channelRead0()"]
  e6d1b4f0_4504_7033_9b12_8cc050126b17 -->|method| ed90f4ad_a5d2_c547_1aac_11625a7ffa30

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/helloworld/client/Http2SettingsHandler.java lines 27–63

public class Http2SettingsHandler extends SimpleChannelInboundHandler<Http2Settings> {
    private final ChannelPromise promise;

    /**
     * Create new instance
     *
     * @param promise Promise object used to notify when first settings are received
     */
    public Http2SettingsHandler(ChannelPromise promise) {
        this.promise = promise;
    }

    /**
     * Wait for this handler to be added after the upgrade to HTTP/2, and for initial preface
     * handshake to complete.
     *
     * @param timeout Time to wait
     * @param unit {@link java.util.concurrent.TimeUnit} for {@code timeout}
     * @throws Exception if timeout or other failure occurs
     */
    public void awaitSettings(long timeout, TimeUnit unit) throws Exception {
        if (!promise.awaitUninterruptibly(timeout, unit)) {
            throw new IllegalStateException("Timed out waiting for settings");
        }
        if (!promise.isSuccess()) {
            throw new RuntimeException(promise.cause());
        }
    }

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Http2Settings msg) throws Exception {
        promise.setSuccess();

        // Only care about the first settings message
        ctx.pipeline().remove(this);
    }
}

Frequently Asked Questions

What is the Http2SettingsHandler class?
Http2SettingsHandler is a class in the netty codebase, defined in example/src/main/java/io/netty/example/http2/helloworld/client/Http2SettingsHandler.java.
Where is Http2SettingsHandler defined?
Http2SettingsHandler is defined in example/src/main/java/io/netty/example/http2/helloworld/client/Http2SettingsHandler.java at line 27.

Analyze Your Own Codebase

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

Try Supermodel Free