Home / Function/ userEventTriggered() — netty Function Reference

userEventTriggered() — netty Function Reference

Architecture documentation for the userEventTriggered() function in Http2MultiplexHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4210b905_a74a_3889_a149_79ceab54fca7["userEventTriggered()"]
  42ad104c_27ce_3949_598d_983571f45120["Http2MultiplexHandler"]
  4210b905_a74a_3889_a149_79ceab54fca7 -->|defined in| 42ad104c_27ce_3949_598d_983571f45120
  d62c1758_06e8_d0f2_282d_fb82aafdbba4["isServer()"]
  4210b905_a74a_3889_a149_79ceab54fca7 -->|calls| d62c1758_06e8_d0f2_282d_fb82aafdbba4
  fe91fd14_df05_cb27_3906_06608a9da8a4["Http2MultiplexHandlerStreamChannel()"]
  4210b905_a74a_3889_a149_79ceab54fca7 -->|calls| fe91fd14_df05_cb27_3906_06608a9da8a4
  5c409190_1743_0fa4_a62a_59d360ea11b0["registerDone()"]
  4210b905_a74a_3889_a149_79ceab54fca7 -->|calls| 5c409190_1743_0fa4_a62a_59d360ea11b0
  style 4210b905_a74a_3889_a149_79ceab54fca7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2MultiplexHandler.java lines 214–275

    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
        if (evt instanceof Http2FrameStreamEvent) {
            Http2FrameStreamEvent event = (Http2FrameStreamEvent) evt;
            DefaultHttp2FrameStream stream = (DefaultHttp2FrameStream) event.stream();
            if (event.type() == Http2FrameStreamEvent.Type.State) {
                switch (stream.state()) {
                    case HALF_CLOSED_LOCAL:
                        if (stream.id() != Http2CodecUtil.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 AbstractHttp2StreamChannel ch;
                        // We need to handle upgrades special when on the client side.
                        if (stream.id() == Http2CodecUtil.HTTP_UPGRADE_STREAM_ID && !isServer(ctx)) {
                            // We must have an upgrade handler or else we can't handle the stream
                            if (upgradeStreamHandler == null) {
                                throw connectionError(INTERNAL_ERROR,
                                        "Client is misconfigured for upgrade requests");
                            }
                            ch = new Http2MultiplexHandlerStreamChannel(stream, upgradeStreamHandler);
                            ch.closeOutbound();
                        } else {
                            ch = new Http2MultiplexHandlerStreamChannel(stream, inboundStreamHandler);
                        }
                        ChannelFuture future = ctx.channel().eventLoop().register(ch);
                        if (future.isDone()) {
                            registerDone(future);
                        } else {
                            future.addListener(CHILD_CHANNEL_REGISTRATION_LISTENER);
                        }
                        break;
                    case CLOSED:
                        AbstractHttp2StreamChannel channel = (AbstractHttp2StreamChannel) stream.attachment;
                        if (channel != null) {
                            channel.streamClosed();
                        }
                        break;
                    default:
                        // ignore for now
                        break;
                }
            }
            return;
        }
        if (evt == ChannelInputShutdownReadComplete.INSTANCE) {
            forEachActiveStream(CHANNEL_INPUT_SHUTDOWN_READ_COMPLETE_VISITOR);
        } else if (evt == ChannelOutputShutdownEvent.INSTANCE) {
            forEachActiveStream(CHANNEL_OUTPUT_SHUTDOWN_EVENT_VISITOR);
        } else if (evt == SslCloseCompletionEvent.SUCCESS) {
            forEachActiveStream(SSL_CLOSE_COMPLETION_EVENT_VISITOR);
        }
        ctx.fireUserEventTriggered(evt);
    }

Domain

Subdomains

Frequently Asked Questions

What does userEventTriggered() do?
userEventTriggered() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2MultiplexHandler.java.
Where is userEventTriggered() defined?
userEventTriggered() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2MultiplexHandler.java at line 214.
What does userEventTriggered() call?
userEventTriggered() calls 3 function(s): Http2MultiplexHandlerStreamChannel, isServer, registerDone.

Analyze Your Own Codebase

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

Try Supermodel Free