Home / Function/ testChannelInitializerReentrance() — netty Function Reference

testChannelInitializerReentrance() — netty Function Reference

Architecture documentation for the testChannelInitializerReentrance() function in ChannelInitializerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  fb80681c_08b8_e96a_7b4b_a7d8ff936b98["testChannelInitializerReentrance()"]
  1d273673_4ec9_d923_c0aa_b8258d9bebe4["ChannelInitializerTest"]
  fb80681c_08b8_e96a_7b4b_a7d8ff936b98 -->|defined in| 1d273673_4ec9_d923_c0aa_b8258d9bebe4
  11b05ced_4326_163a_b4b0_80f149ff9b35["channelRegistered()"]
  fb80681c_08b8_e96a_7b4b_a7d8ff936b98 -->|calls| 11b05ced_4326_163a_b4b0_80f149ff9b35
  style fb80681c_08b8_e96a_7b4b_a7d8ff936b98 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/ChannelInitializerTest.java lines 160–194

    @Test
    public void testChannelInitializerReentrance() {
        final AtomicInteger registeredCalled = new AtomicInteger(0);
        final ChannelInboundHandlerAdapter handler1 = new ChannelInboundHandlerAdapter() {
            @Override
            public void channelRegistered(ChannelHandlerContext ctx) {
                registeredCalled.incrementAndGet();
            }
        };
        final AtomicInteger initChannelCalled = new AtomicInteger(0);
        client.handler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) {
                initChannelCalled.incrementAndGet();
                ch.pipeline().addLast(handler1);
                ch.pipeline().fireChannelRegistered();
            }
        }).localAddress(LocalAddress.ANY);

        Channel channel = client.bind().syncUninterruptibly().channel();
        try {
            // Execute some task on the EventLoop and wait until its done to be sure all handlers are added to the
            // pipeline.
            channel.eventLoop().submit(new Runnable() {
                @Override
                public void run() {
                    // NOOP
                }
            }).syncUninterruptibly();
            assertEquals(1, initChannelCalled.get());
            assertEquals(2, registeredCalled.get());
        } finally {
            channel.close().syncUninterruptibly();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testChannelInitializerReentrance() do?
testChannelInitializerReentrance() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/ChannelInitializerTest.java.
Where is testChannelInitializerReentrance() defined?
testChannelInitializerReentrance() is defined in transport/src/test/java/io/netty/channel/ChannelInitializerTest.java at line 160.
What does testChannelInitializerReentrance() call?
testChannelInitializerReentrance() calls 1 function(s): channelRegistered.

Analyze Your Own Codebase

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

Try Supermodel Free