Home / Function/ testChannelsRegistered() — netty Function Reference

testChannelsRegistered() — netty Function Reference

Architecture documentation for the testChannelsRegistered() function in NioEventLoopTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  1d5d2853_c878_64cb_71c4_035df727a71d["testChannelsRegistered()"]
  744640b8_9d8b_07b6_4d95_821961ea4e63["NioEventLoopTest"]
  1d5d2853_c878_64cb_71c4_035df727a71d -->|defined in| 744640b8_9d8b_07b6_4d95_821961ea4e63
  03111d71_2c58_836d_46ee_3ad103158700["registeredChannels()"]
  1d5d2853_c878_64cb_71c4_035df727a71d -->|calls| 03111d71_2c58_836d_46ee_3ad103158700
  style 1d5d2853_c878_64cb_71c4_035df727a71d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java lines 279–306

    @Test
    @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
    public void testChannelsRegistered() throws Exception {
        EventLoopGroup group = new NioEventLoopGroup(1);
        try {
            final SingleThreadIoEventLoop loop = (SingleThreadIoEventLoop) group.next();
            final Channel ch1 = new NioServerSocketChannel();
            final Channel ch2 = new NioServerSocketChannel();

            assertEquals(0, registeredChannels(loop));

            assertTrue(loop.register(ch1).syncUninterruptibly().isSuccess());
            assertTrue(loop.register(ch2).syncUninterruptibly().isSuccess());
            assertEquals(2, registeredChannels(loop));

            assertTrue(ch1.deregister().syncUninterruptibly().isSuccess());

            int registered;
            // As SelectionKeys are removed in a lazy fashion in the JDK implementation we may need to query a few
            // times before we see the right number of registered chanels.
            while ((registered = registeredChannels(loop)) == 2) {
                Thread.sleep(50);
            }
            assertEquals(1, registered);
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testChannelsRegistered() do?
testChannelsRegistered() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java.
Where is testChannelsRegistered() defined?
testChannelsRegistered() is defined in transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java at line 279.
What does testChannelsRegistered() call?
testChannelsRegistered() calls 1 function(s): registeredChannels.

Analyze Your Own Codebase

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

Try Supermodel Free