Home / Function/ anyIdle() — netty Function Reference

anyIdle() — netty Function Reference

Architecture documentation for the anyIdle() function in IdleStateHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  13551606_9cf0_6ceb_85f9_d637333fc038["anyIdle()"]
  f1a156c3_6366_afc7_6b64_9543e5f91ba9["IdleStateHandlerTest"]
  13551606_9cf0_6ceb_85f9_d637333fc038 -->|defined in| f1a156c3_6366_afc7_6b64_9543e5f91ba9
  ceebc117_e04c_1d25_7956_ad5233e6fcc2["testReaderIdle()"]
  ceebc117_e04c_1d25_7956_ad5233e6fcc2 -->|calls| 13551606_9cf0_6ceb_85f9_d637333fc038
  2524cfc4_eca5_6bcc_fadf_d5abd37833a1["testWriterIdle()"]
  2524cfc4_eca5_6bcc_fadf_d5abd37833a1 -->|calls| 13551606_9cf0_6ceb_85f9_d637333fc038
  6302e225_7f9a_b306_5c0d_6979f5980c69["testAllIdle()"]
  6302e225_7f9a_b306_5c0d_6979f5980c69 -->|calls| 13551606_9cf0_6ceb_85f9_d637333fc038
  style 13551606_9cf0_6ceb_85f9_d637333fc038 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/timeout/IdleStateHandlerTest.java lines 67–99

    private static void anyIdle(IdleStateHandler idleStateHandler, Object... expected) throws Exception {
        assertThat(expected.length).isGreaterThanOrEqualTo(1);

        final List<Object> events = new ArrayList<Object>();
        ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
            @Override
            public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
                events.add(evt);
            }
        };

        EmbeddedChannel channel = new EmbeddedChannel(idleStateHandler, handler);
        channel.freezeTime();
        try {
            // For each expected event advance the ticker and run() the task. Each
            // step should yield in an IdleStateEvent because we haven't written
            // or read anything from the channel.
            for (int i = 0; i < expected.length; i++) {
                channel.advanceTimeBy(1, TimeUnit.SECONDS);
                channel.runPendingTasks();
            }

            assertEquals(expected.length, events.size());

            // Compare the expected with the actual IdleStateEvents
            for (int i = 0; i < expected.length; i++) {
                Object evt = events.get(i);
                assertSame(expected[i], evt, "Element " + i + " is not matching");
            }
        } finally {
            channel.finishAndReleaseAll();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does anyIdle() do?
anyIdle() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/timeout/IdleStateHandlerTest.java.
Where is anyIdle() defined?
anyIdle() is defined in handler/src/test/java/io/netty/handler/timeout/IdleStateHandlerTest.java at line 67.
What calls anyIdle()?
anyIdle() is called by 3 function(s): testAllIdle, testReaderIdle, testWriterIdle.

Analyze Your Own Codebase

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

Try Supermodel Free