Home / Class/ CheckEventExecutorHandler Class — netty Architecture

CheckEventExecutorHandler Class — netty Architecture

Architecture documentation for the CheckEventExecutorHandler class in DefaultChannelPipelineTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a3de3ac1_8b11_1455_2fb4_1f6fbefec5d0["CheckEventExecutorHandler"]
  ded22145_bbcf_15a1_69b7_30cac8d4be02["DefaultChannelPipelineTest.java"]
  a3de3ac1_8b11_1455_2fb4_1f6fbefec5d0 -->|defined in| ded22145_bbcf_15a1_69b7_30cac8d4be02
  ac30b8e8_9379_bd28_0530_7a31e274fbef["CheckEventExecutorHandler()"]
  a3de3ac1_8b11_1455_2fb4_1f6fbefec5d0 -->|method| ac30b8e8_9379_bd28_0530_7a31e274fbef
  79ac8b37_cf44_c6e9_313d_67392c43757c["handlerAdded()"]
  a3de3ac1_8b11_1455_2fb4_1f6fbefec5d0 -->|method| 79ac8b37_cf44_c6e9_313d_67392c43757c
  28107c94_db85_380b_dc39_f590c93690f2["handlerRemoved()"]
  a3de3ac1_8b11_1455_2fb4_1f6fbefec5d0 -->|method| 28107c94_db85_380b_dc39_f590c93690f2
  151488c4_dff5_3770_3c96_c60f435e4ade["assertExecutor()"]
  a3de3ac1_8b11_1455_2fb4_1f6fbefec5d0 -->|method| 151488c4_dff5_3770_3c96_c60f435e4ade

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java lines 2355–2390

    private static final class CheckEventExecutorHandler extends ChannelHandlerAdapter {
        final EventExecutor executor;
        final Promise<Void> addedPromise;
        final Promise<Void> removedPromise;

        CheckEventExecutorHandler(EventExecutor executor) {
            this.executor = executor;
            addedPromise = executor.newPromise();
            removedPromise = executor.newPromise();
        }

        @Override
        public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
            assertExecutor(ctx, addedPromise);
        }

        @Override
        public void handlerRemoved(ChannelHandlerContext ctx) {
            assertExecutor(ctx, removedPromise);
        }

        private void assertExecutor(ChannelHandlerContext ctx, Promise<Void> promise) {
            final boolean same;
            try {
                same = executor == ctx.executor();
            } catch (Throwable cause) {
                promise.setFailure(cause);
                return;
            }
            if (same) {
                promise.setSuccess(null);
            } else {
                promise.setFailure(new AssertionError("EventExecutor not the same"));
            }
        }
    }

Frequently Asked Questions

What is the CheckEventExecutorHandler class?
CheckEventExecutorHandler is a class in the netty codebase, defined in transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java.
Where is CheckEventExecutorHandler defined?
CheckEventExecutorHandler is defined in transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java at line 2355.

Analyze Your Own Codebase

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

Try Supermodel Free