Home / Function/ testChannelOptionOrderPreserve() — netty Function Reference

testChannelOptionOrderPreserve() — netty Function Reference

Architecture documentation for the testChannelOptionOrderPreserve() function in BootstrapTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9d0bb81f_ccb9_23aa_c090_56eef310664c["testChannelOptionOrderPreserve()"]
  7a7606db_8d2a_bfe0_9993_4aaa8e0a6e42["BootstrapTest"]
  9d0bb81f_ccb9_23aa_c090_56eef310664c -->|defined in| 7a7606db_8d2a_bfe0_9993_4aaa8e0a6e42
  a280231b_b7f6_6516_eca7_5b3ecdba4d35["ChannelConfigValidator()"]
  9d0bb81f_ccb9_23aa_c090_56eef310664c -->|calls| a280231b_b7f6_6516_eca7_5b3ecdba4d35
  ac2dcd41_a34b_9dc6_1a2b_3d4ccbaed042["setOption()"]
  9d0bb81f_ccb9_23aa_c090_56eef310664c -->|calls| ac2dcd41_a34b_9dc6_1a2b_3d4ccbaed042
  style 9d0bb81f_ccb9_23aa_c090_56eef310664c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/bootstrap/BootstrapTest.java lines 447–495

    @Test
    public void testChannelOptionOrderPreserve() throws InterruptedException {
        final BlockingQueue<ChannelOption<?>> options = new LinkedBlockingQueue<ChannelOption<?>>();
        class ChannelConfigValidator extends DefaultChannelConfig {
            ChannelConfigValidator(Channel channel) {
                super(channel);
            }

            @Override
            public <T> boolean setOption(ChannelOption<T> option, T value) {
                options.add(option);
                return super.setOption(option, value);
            }
        }
        final CountDownLatch latch = new CountDownLatch(1);
        final Bootstrap bootstrap = new Bootstrap()
                .handler(new ChannelInitializer<Channel>() {
                    @Override
                    protected void initChannel(Channel ch) {
                        latch.countDown();
                    }
                })
                .group(groupA)
                .channelFactory(new ChannelFactory<Channel>() {
                    @Override
                    public Channel newChannel() {
                        return new LocalChannel() {
                            private ChannelConfigValidator config;
                            @Override
                            public synchronized ChannelConfig config() {
                                if (config == null) {
                                    config = new ChannelConfigValidator(this);
                                }
                                return config;
                            }
                        };
                    }
                })
                .option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, 1)
                .option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, 2);

        bootstrap.register().syncUninterruptibly();

        latch.await();

        // Check the order is the same as what we defined before.
        assertSame(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, options.take());
        assertSame(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, options.take());
    }

Domain

Subdomains

Frequently Asked Questions

What does testChannelOptionOrderPreserve() do?
testChannelOptionOrderPreserve() is a function in the netty codebase, defined in transport/src/test/java/io/netty/bootstrap/BootstrapTest.java.
Where is testChannelOptionOrderPreserve() defined?
testChannelOptionOrderPreserve() is defined in transport/src/test/java/io/netty/bootstrap/BootstrapTest.java at line 447.
What does testChannelOptionOrderPreserve() call?
testChannelOptionOrderPreserve() calls 2 function(s): ChannelConfigValidator, setOption.

Analyze Your Own Codebase

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

Try Supermodel Free