Home / Function/ userEventTriggered() — netty Function Reference

userEventTriggered() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4c3d3913_a400_e447_0997_8e68ce8c89a7["userEventTriggered()"]
  ba77a225_4637_fe77_ee1f_54a9774ca7f8["Http2FrameCodec"]
  4c3d3913_a400_e447_0997_8e68ce8c89a7 -->|defined in| ba77a225_4637_fe77_ee1f_54a9774ca7f8
  00a9b5ed_642d_3de9_0443_03f66b22d1c8["tryExpandConnectionFlowControlWindow()"]
  4c3d3913_a400_e447_0997_8e68ce8c89a7 -->|calls| 00a9b5ed_642d_3de9_0443_03f66b22d1c8
  7795823d_413a_96d1_ee63_6dda0df913d5["handlerAdded()"]
  4c3d3913_a400_e447_0997_8e68ce8c89a7 -->|calls| 7795823d_413a_96d1_ee63_6dda0df913d5
  223ea4e7_5880_5c47_48fd_4e2909ca6399["onUpgradeEvent()"]
  4c3d3913_a400_e447_0997_8e68ce8c89a7 -->|calls| 223ea4e7_5880_5c47_48fd_4e2909ca6399
  09e52591_c46e_9d07_b07a_a22b76c320a6["onStreamActive0()"]
  4c3d3913_a400_e447_0997_8e68ce8c89a7 -->|calls| 09e52591_c46e_9d07_b07a_a22b76c320a6
  f506663e_a3fd_bcb6_ca40_6da0b91c8c1c["onUserEventTriggered()"]
  4c3d3913_a400_e447_0997_8e68ce8c89a7 -->|calls| f506663e_a3fd_bcb6_ca40_6da0b91c8c1c
  style 4c3d3913_a400_e447_0997_8e68ce8c89a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java lines 254–292

    @Override
    public final void userEventTriggered(final ChannelHandlerContext ctx, final Object evt) throws Exception {
        if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
            // The user event implies that we are on the client.
            tryExpandConnectionFlowControlWindow(connection());

            // We schedule this on the EventExecutor to allow to have any extra handlers added to the pipeline
            // before we pass the event to the next handler. This is needed as the event may be called from within
            // handlerAdded(...) which will be run before other handlers will be added to the pipeline.
            ctx.executor().execute(new Runnable() {
                @Override
                public void run() {
                    ctx.fireUserEventTriggered(evt);
                }
            });
        } else if (evt instanceof UpgradeEvent) {
            UpgradeEvent upgrade = (UpgradeEvent) evt;
            try {
                onUpgradeEvent(ctx, upgrade.retain());
                Http2Stream stream = connection().stream(HTTP_UPGRADE_STREAM_ID);
                if (stream.getProperty(streamKey) == null) {
                    // TODO: improve handler/stream lifecycle so that stream isn't active before handler added.
                    // The stream was already made active, but ctx may have been null so it wasn't initialized.
                    // https://github.com/netty/netty/issues/4942
                    onStreamActive0(stream);
                }
                upgrade.upgradeRequest().headers().setInt(
                        HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text(), HTTP_UPGRADE_STREAM_ID);
                stream.setProperty(upgradeKey, true);
                InboundHttpToHttp2Adapter.handle(
                        ctx, connection(), decoder().frameListener(), upgrade.upgradeRequest().retain());
            } finally {
                upgrade.release();
            }
        } else {
            onUserEventTriggered(ctx, evt);
            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/Http2FrameCodec.java.
Where is userEventTriggered() defined?
userEventTriggered() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java at line 254.
What does userEventTriggered() call?
userEventTriggered() calls 5 function(s): handlerAdded, onStreamActive0, onUpgradeEvent, onUserEventTriggered, tryExpandConnectionFlowControlWindow.

Analyze Your Own Codebase

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

Try Supermodel Free