Home / Function/ testRebuildSelectorOnIOException() — netty Function Reference

testRebuildSelectorOnIOException() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java lines 238–277

    @Test
    public void testRebuildSelectorOnIOException() {
        SelectStrategyFactory selectStrategyFactory = new SelectStrategyFactory() {
            @Override
            public SelectStrategy newSelectStrategy() {
                return new SelectStrategy() {

                    private boolean thrown;

                    @Override
                    public int calculateStrategy(IntSupplier selectSupplier, boolean hasTasks) throws Exception {
                        if (!thrown) {
                            thrown = true;
                            throw new IOException();
                        }
                        return -1;
                    }
                };
            }
        };

        EventLoopGroup group = new NioEventLoopGroup(1, new DefaultThreadFactory("ioPool"),
                                                     SelectorProvider.provider(), selectStrategyFactory);
        final NioEventLoop loop = (NioEventLoop) group.next();
        try {
            Channel channel = new NioServerSocketChannel();
            Selector selector = loop.unwrappedSelector();

            loop.register(channel).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 testRebuildSelectorOnIOException() do?
testRebuildSelectorOnIOException() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java.
Where is testRebuildSelectorOnIOException() defined?
testRebuildSelectorOnIOException() is defined in transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java at line 238.

Analyze Your Own Codebase

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

Try Supermodel Free