Home / Function/ testRebuildSelector() — netty Function Reference

testRebuildSelector() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  142a8f34_03b7_054c_2f02_13c2d0649b8a["testRebuildSelector()"]
  744640b8_9d8b_07b6_4d95_821961ea4e63["NioEventLoopTest"]
  142a8f34_03b7_054c_2f02_13c2d0649b8a -->|defined in| 744640b8_9d8b_07b6_4d95_821961ea4e63
  style 142a8f34_03b7_054c_2f02_13c2d0649b8a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java lines 75–104

    @Test
    public void testRebuildSelector() {
        EventLoopGroup group = new NioEventLoopGroup(1);
        final NioEventLoop loop = (NioEventLoop) group.next();
        try {
            Channel channel = new NioServerSocketChannel();
            loop.register(channel).syncUninterruptibly();

            Selector selector = loop.unwrappedSelector();
            assertSame(selector, ((NioEventLoop) channel.eventLoop()).unwrappedSelector());
            assertTrue(selector.isOpen());

            // Submit to the EventLoop so we are sure its really executed in a non-async manner.
            loop.submit(new Runnable() {
                @Override
                public void run() {
                    loop.rebuildSelector();
                }
            }).syncUninterruptibly();

            Selector newSelector = ((NioEventLoop) channel.eventLoop()).unwrappedSelector();
            assertTrue(newSelector.isOpen());
            assertNotSame(selector, newSelector);
            assertFalse(selector.isOpen());

            channel.close().syncUninterruptibly();
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testRebuildSelector() do?
testRebuildSelector() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java.
Where is testRebuildSelector() defined?
testRebuildSelector() is defined in transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java at line 75.

Analyze Your Own Codebase

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

Try Supermodel Free