Home / Function/ userEventTriggered() — netty Function Reference

userEventTriggered() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  880f358e_d7d7_b607_f597_19124ca4364e["userEventTriggered()"]
  0233e67b_aa3b_d75b_4c03_f8c1ecbc9db1["ApplicationProtocolNegotiationHandler"]
  880f358e_d7d7_b607_f597_19124ca4364e -->|defined in| 0233e67b_aa3b_d75b_4c03_f8c1ecbc9db1
  e92127ac_0c6e_3476_dbcc_4f2261e55def["configurePipeline()"]
  880f358e_d7d7_b607_f597_19124ca4364e -->|calls| e92127ac_0c6e_3476_dbcc_4f2261e55def
  6d5c26f8_b0b4_a613_e7c9_27748639d0b3["exceptionCaught()"]
  880f358e_d7d7_b607_f597_19124ca4364e -->|calls| 6d5c26f8_b0b4_a613_e7c9_27748639d0b3
  ff97ac71_5935_7324_8055_fd73efd9c995["removeSelfIfPresent()"]
  880f358e_d7d7_b607_f597_19124ca4364e -->|calls| ff97ac71_5935_7324_8055_fd73efd9c995
  291c1c5b_f3f2_7e72_e7dd_25424b02cebf["fireBufferedMessages()"]
  880f358e_d7d7_b607_f597_19124ca4364e -->|calls| 291c1c5b_f3f2_7e72_e7dd_25424b02cebf
  style 880f358e_d7d7_b607_f597_19124ca4364e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/ApplicationProtocolNegotiationHandler.java lines 127–162

    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
        if (evt instanceof SslHandshakeCompletionEvent) {
            SslHandshakeCompletionEvent handshakeEvent = (SslHandshakeCompletionEvent) evt;
            try {
                if (handshakeEvent.isSuccess()) {
                    SslHandler sslHandler = ctx.pipeline().get(SslHandler.class);
                    if (sslHandler == null) {
                        throw new IllegalStateException("cannot find an SslHandler in the pipeline (required for "
                                + "application-level protocol negotiation)");
                    }
                    String protocol = sslHandler.applicationProtocol();
                    configurePipeline(ctx, protocol != null ? protocol : fallbackProtocol);
                } else {
                    // if the event is not produced because of an successful handshake we will receive the same
                    // exception in exceptionCaught(...) and handle it there. This will allow us more fine-grained
                    // control over which exception we propagate down the ChannelPipeline.
                    //
                    // See https://github.com/netty/netty/issues/10342
                }
            } catch (Throwable cause) {
                exceptionCaught(ctx, cause);
            } finally {
                // Handshake failures are handled in exceptionCaught(...).
                if (handshakeEvent.isSuccess()) {
                    removeSelfIfPresent(ctx);
                }
            }
        }

        if (evt instanceof ChannelInputShutdownEvent) {
            fireBufferedMessages();
        }

        ctx.fireUserEventTriggered(evt);
    }

Domain

Subdomains

Frequently Asked Questions

What does userEventTriggered() do?
userEventTriggered() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/ApplicationProtocolNegotiationHandler.java.
Where is userEventTriggered() defined?
userEventTriggered() is defined in handler/src/main/java/io/netty/handler/ssl/ApplicationProtocolNegotiationHandler.java at line 127.
What does userEventTriggered() call?
userEventTriggered() calls 4 function(s): configurePipeline, exceptionCaught, fireBufferedMessages, removeSelfIfPresent.

Analyze Your Own Codebase

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

Try Supermodel Free