Home / Function/ registered() — netty Function Reference

registered() — netty Function Reference

Architecture documentation for the registered() function in LocalChannel.java from the netty codebase.

Function java Buffer Telemetry calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  562d5c11_6ff6_9b17_d006_101ff1054c95["registered()"]
  84d2a0d7_132c_c9dd_926c_de7389277737["LocalUnsafe"]
  562d5c11_6ff6_9b17_d006_101ff1054c95 -->|defined in| 84d2a0d7_132c_c9dd_926c_de7389277737
  9f78cf60_4bba_256d_19f7_ed523fbe93ff["doRegister()"]
  9f78cf60_4bba_256d_19f7_ed523fbe93ff -->|calls| 562d5c11_6ff6_9b17_d006_101ff1054c95
  f1b1c04a_89d4_cfdf_491a_2834d7b50724["doClose()"]
  562d5c11_6ff6_9b17_d006_101ff1054c95 -->|calls| f1b1c04a_89d4_cfdf_491a_2834d7b50724
  style 562d5c11_6ff6_9b17_d006_101ff1054c95 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/local/LocalChannel.java lines 491–525

        @Override
        public void registered() {
            // Check if both peer and parent are non-null because this channel was created by a LocalServerChannel.
            // This is needed as a peer may not be null also if a LocalChannel was connected before and
            // deregistered / registered later again.
            //
            // See https://github.com/netty/netty/issues/2400
            if (peer != null && parent() != null) {
                // Store the peer in a local variable as it may be set to null if doClose() is called.
                // See https://github.com/netty/netty/issues/2144
                final LocalChannel peer = LocalChannel.this.peer;
                state = State.CONNECTED;

                peer.remoteAddress = parent() == null ? null : parent().localAddress();
                peer.state = State.CONNECTED;

                // Always call peer.eventLoop().execute() even if peer.eventLoop().inEventLoop() is true.
                // This ensures that if both channels are on the same event loop, the peer's channelActive
                // event is triggered *after* this channel's channelRegistered event, so that this channel's
                // pipeline is fully initialized by ChannelInitializer before any channelRead events.
                peer.eventLoop().execute(new Runnable() {
                    @Override
                    public void run() {
                        ChannelPromise promise = peer.connectPromise;

                        // Only trigger fireChannelActive() if the promise was not null and was not completed yet.
                        // connectPromise may be set to null if doClose() was called in the meantime.
                        if (promise != null && promise.trySuccess()) {
                            peer.pipeline().fireChannelActive();
                        }
                    }
                });
            }
            ((SingleThreadEventExecutor) eventLoop()).addShutdownHook(shutdownHook);
        }

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does registered() do?
registered() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/local/LocalChannel.java.
Where is registered() defined?
registered() is defined in transport/src/main/java/io/netty/channel/local/LocalChannel.java at line 491.
What does registered() call?
registered() calls 1 function(s): doClose.
What calls registered()?
registered() is called by 1 function(s): doRegister.

Analyze Your Own Codebase

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

Try Supermodel Free