Home / Function/ testReRegisterEventLoop() — netty Function Reference

testReRegisterEventLoop() — netty Function Reference

Architecture documentation for the testReRegisterEventLoop() function in EmbeddedChannelTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  49507e12_a80c_bab3_a13a_d4a206139f81["testReRegisterEventLoop()"]
  300cabef_b042_697f_5623_37ce249f504d["EmbeddedChannelTest"]
  49507e12_a80c_bab3_a13a_d4a206139f81 -->|defined in| 300cabef_b042_697f_5623_37ce249f504d
  style 49507e12_a80c_bab3_a13a_d4a206139f81 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java lines 605–644

    @Test
    public void testReRegisterEventLoop() throws Exception {
        final CountDownLatch unregisteredLatch = new CountDownLatch(1);
        final CountDownLatch registeredLatch = new CountDownLatch(2);
        final EmbeddedChannel channel = new EmbeddedChannel(new ChannelInboundHandlerAdapter() {
            @Override
            public void channelUnregistered(ChannelHandlerContext ctx) {
                unregisteredLatch.countDown();
            }

            @Override
            public void channelRegistered(ChannelHandlerContext ctx) {
                registeredLatch.countDown();
            }
        });

        final EmbeddedEventLoop embeddedEventLoop = new EmbeddedEventLoop(new EmbeddedEventLoop.FreezableTicker());
        channel.deregister().addListener(f -> embeddedEventLoop.register(channel));

        if (!unregisteredLatch.await(5, TimeUnit.SECONDS)) {
            fail("Channel was not unregistered in time.");
        }

        if (!registeredLatch.await(5, TimeUnit.SECONDS)) {
            fail("Channel was not registered in time.");
        }

        final CountDownLatch taskLatch = new CountDownLatch(1);
        channel.eventLoop().execute(new Runnable() {
            @Override
            public void run() {
                taskLatch.countDown();
            }
        });

        channel.runPendingTasks();
        if (!taskLatch.await(5, TimeUnit.SECONDS)) {
            fail("Task was not executed in time.");
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testReRegisterEventLoop() do?
testReRegisterEventLoop() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java.
Where is testReRegisterEventLoop() defined?
testReRegisterEventLoop() is defined in transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java at line 605.

Analyze Your Own Codebase

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

Try Supermodel Free