Home / Function/ testInterruptEventLoopThread() — netty Function Reference

testInterruptEventLoopThread() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java lines 123–164

    @Test
    public void testInterruptEventLoopThread() throws Exception {
        EventLoopGroup group = new NioEventLoopGroup(1);
        final NioEventLoop loop = (NioEventLoop) group.next();
        try {
            Selector selector = loop.unwrappedSelector();
            assertTrue(selector.isOpen());

            loop.submit(new Runnable() {
                @Override
                public void run() {
                    // Interrupt the thread which should not end-up in a busy spin and
                    // so the selector should not have been rebuild.
                    Thread.currentThread().interrupt();
                }
            }).syncUninterruptibly();

            assertTrue(selector.isOpen());

            final CountDownLatch latch = new CountDownLatch(2);
            loop.submit(new Runnable() {
                @Override
                public void run() {
                    latch.countDown();
                }
            }).syncUninterruptibly();

            loop.schedule(new Runnable() {
                @Override
                public void run() {
                    latch.countDown();
                }
            }, 2, TimeUnit.SECONDS).syncUninterruptibly();

            latch.await();

            assertSame(selector, loop.unwrappedSelector());
            assertTrue(selector.isOpen());
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free