Home / Function/ testThrowInOtherHandlerAfterInvokedFromExceptionCaught() — netty Function Reference

testThrowInOtherHandlerAfterInvokedFromExceptionCaught() — netty Function Reference

Architecture documentation for the testThrowInOtherHandlerAfterInvokedFromExceptionCaught() function in DefaultChannelPipelineTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ed76dd35_c621_c934_2ef4_99b1d354644d["testThrowInOtherHandlerAfterInvokedFromExceptionCaught()"]
  666d912b_4166_a807_ed10_ba12f328a7b2["DefaultChannelPipelineTest"]
  ed76dd35_c621_c934_2ef4_99b1d354644d -->|defined in| 666d912b_4166_a807_ed10_ba12f328a7b2
  36fce318_f10e_2b70_4def_d189ac0af1ed["execute()"]
  ed76dd35_c621_c934_2ef4_99b1d354644d -->|calls| 36fce318_f10e_2b70_4def_d189ac0af1ed
  2d2a762a_b2a7_b92f_c9a9_231778acb218["run()"]
  ed76dd35_c621_c934_2ef4_99b1d354644d -->|calls| 2d2a762a_b2a7_b92f_c9a9_231778acb218
  a12a2410_e438_f512_b8d3_96d804c10f97["channelReadComplete()"]
  ed76dd35_c621_c934_2ef4_99b1d354644d -->|calls| a12a2410_e438_f512_b8d3_96d804c10f97
  0734e696_bf2a_45af_707c_9731756d1f7d["close()"]
  ed76dd35_c621_c934_2ef4_99b1d354644d -->|calls| 0734e696_bf2a_45af_707c_9731756d1f7d
  8c52b958_e400_144f_b4f2_e60153ac0d1a["exceptionCaught()"]
  ed76dd35_c621_c934_2ef4_99b1d354644d -->|calls| 8c52b958_e400_144f_b4f2_e60153ac0d1a
  style ed76dd35_c621_c934_2ef4_99b1d354644d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java lines 394–436

    @Test
    @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
    public void testThrowInOtherHandlerAfterInvokedFromExceptionCaught() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final AtomicInteger counter = new AtomicInteger();
        Channel channel = new LocalChannel();
        try {
            group.register(channel).syncUninterruptibly();
            channel.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                @Override
                public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
                    ctx.fireChannelReadComplete();
                }
            }, new ChannelInboundHandlerAdapter() {
                class TestException extends Exception { }

                @Override
                public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
                    throw new TestException();
                }

                @Override
                public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
                    if (cause instanceof TestException) {
                        ctx.executor().execute(new Runnable() {
                            @Override
                            public void run() {
                                latch.countDown();
                            }
                        });
                    }
                    counter.incrementAndGet();
                    throw new Exception();
                }
            });

            channel.pipeline().fireExceptionCaught(new Exception());
            latch.await();
            assertEquals(1, counter.get());
        } finally {
            channel.close().syncUninterruptibly();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testThrowInOtherHandlerAfterInvokedFromExceptionCaught() do?
testThrowInOtherHandlerAfterInvokedFromExceptionCaught() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java.
Where is testThrowInOtherHandlerAfterInvokedFromExceptionCaught() defined?
testThrowInOtherHandlerAfterInvokedFromExceptionCaught() is defined in transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java at line 394.
What does testThrowInOtherHandlerAfterInvokedFromExceptionCaught() call?
testThrowInOtherHandlerAfterInvokedFromExceptionCaught() calls 5 function(s): channelReadComplete, close, exceptionCaught, execute, run.

Analyze Your Own Codebase

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

Try Supermodel Free