Home / Function/ testGlobalWriteThrottle() — netty Function Reference

testGlobalWriteThrottle() — netty Function Reference

Architecture documentation for the testGlobalWriteThrottle() function in FileRegionThrottleTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  8aa56c28_7a0e_99b9_cd3f_ce510336d931["testGlobalWriteThrottle()"]
  446f1e15_06cc_5ba2_8909_c276a7d8f4d2["FileRegionThrottleTest"]
  8aa56c28_7a0e_99b9_cd3f_ce510336d931 -->|defined in| 446f1e15_06cc_5ba2_8909_c276a7d8f4d2
  95e7b05f_318e_eca3_e1ab_7843dbe13d9b["ReadHandler()"]
  8aa56c28_7a0e_99b9_cd3f_ce510336d931 -->|calls| 95e7b05f_318e_eca3_e1ab_7843dbe13d9b
  style 8aa56c28_7a0e_99b9_cd3f_ce510336d931 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/traffic/FileRegionThrottleTest.java lines 87–111

    @Disabled("This test is flaky, need more investigation")
    @Test
    public void testGlobalWriteThrottle() throws Exception {
        final CountDownLatch latch = new CountDownLatch(1);
        final GlobalTrafficShapingHandler gtsh = new GlobalTrafficShapingHandler(group, WRITE_LIMIT, 0);
        ServerBootstrap bs = new ServerBootstrap();
        bs.group(group).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>() {
            @Override
            protected void initChannel(SocketChannel ch) {
                ch.pipeline().addLast(new LineBasedFrameDecoder(Integer.MAX_VALUE));
                ch.pipeline().addLast(new MessageDecoder());
                ch.pipeline().addLast(gtsh);
            }
        });
        Channel sc = bs.bind(0).sync().channel();
        Channel cc = clientConnect(sc.localAddress(), new ReadHandler(latch)).channel();

        long start = TrafficCounter.milliSecondFromNano();
        cc.writeAndFlush(Unpooled.copiedBuffer("send-file\n", CharsetUtil.US_ASCII)).sync();
        latch.await();
        long timeTaken = TrafficCounter.milliSecondFromNano() - start;
        assertTrue(timeTaken > 3000, "Data streamed faster than expected");
        sc.close().sync();
        cc.close().sync();
    }

Domain

Subdomains

Frequently Asked Questions

What does testGlobalWriteThrottle() do?
testGlobalWriteThrottle() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/traffic/FileRegionThrottleTest.java.
Where is testGlobalWriteThrottle() defined?
testGlobalWriteThrottle() is defined in handler/src/test/java/io/netty/handler/traffic/FileRegionThrottleTest.java at line 87.
What does testGlobalWriteThrottle() call?
testGlobalWriteThrottle() calls 1 function(s): ReadHandler.

Analyze Your Own Codebase

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

Try Supermodel Free