Home / Function/ onHttp2StreamStateChanged() — netty Function Reference

onHttp2StreamStateChanged() — netty Function Reference

Architecture documentation for the onHttp2StreamStateChanged() function in Http2MultiplexCodec.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7c2b2a8f_41e8_7ac2_1687_1d9ce90d5bea["onHttp2StreamStateChanged()"]
  a7ac469b_ce05_746a_3b73_34450541872b["Http2MultiplexCodec"]
  7c2b2a8f_41e8_7ac2_1687_1d9ce90d5bea -->|defined in| a7ac469b_ce05_746a_3b73_34450541872b
  8c18f093_5f9c_9bf5_be2f_a8fadf34052c["Http2MultiplexCodecStreamChannel()"]
  7c2b2a8f_41e8_7ac2_1687_1d9ce90d5bea -->|calls| 8c18f093_5f9c_9bf5_be2f_a8fadf34052c
  style 7c2b2a8f_41e8_7ac2_1687_1d9ce90d5bea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2MultiplexCodec.java lines 155–199

    @Override
    final void onHttp2StreamStateChanged(ChannelHandlerContext ctx, DefaultHttp2FrameStream stream) {
        switch (stream.state()) {
            case HALF_CLOSED_LOCAL:
                if (stream.id() != HTTP_UPGRADE_STREAM_ID) {
                    // Ignore everything which was not caused by an upgrade
                    break;
                }
                // fall-through
            case HALF_CLOSED_REMOTE:
                // fall-through
            case OPEN:
                if (stream.attachment != null) {
                    // ignore if child channel was already created.
                    break;
                }
                final Http2MultiplexCodecStreamChannel streamChannel;
                // We need to handle upgrades special when on the client side.
                if (stream.id() == HTTP_UPGRADE_STREAM_ID && !connection().isServer()) {
                    // Add our upgrade handler to the channel and then register the channel.
                    // The register call fires the channelActive, etc.
                    assert upgradeStreamHandler != null;
                    streamChannel = new Http2MultiplexCodecStreamChannel(stream, upgradeStreamHandler);
                    streamChannel.closeOutbound();
                } else {
                    streamChannel = new Http2MultiplexCodecStreamChannel(stream, inboundStreamHandler);
                }
                ChannelFuture future = ctx.channel().eventLoop().register(streamChannel);
                if (future.isDone()) {
                    Http2MultiplexHandler.registerDone(future);
                } else {
                    future.addListener(Http2MultiplexHandler.CHILD_CHANNEL_REGISTRATION_LISTENER);
                }
                break;
            case CLOSED:
                AbstractHttp2StreamChannel channel = (AbstractHttp2StreamChannel) stream.attachment;
                if (channel != null) {
                    channel.streamClosed();
                }
                break;
            default:
                // ignore for now
                break;
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does onHttp2StreamStateChanged() do?
onHttp2StreamStateChanged() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2MultiplexCodec.java.
Where is onHttp2StreamStateChanged() defined?
onHttp2StreamStateChanged() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2MultiplexCodec.java at line 155.
What does onHttp2StreamStateChanged() call?
onHttp2StreamStateChanged() calls 1 function(s): Http2MultiplexCodecStreamChannel.

Analyze Your Own Codebase

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

Try Supermodel Free