Home / Function/ write() — netty Function Reference

write() — netty Function Reference

Architecture documentation for the write() function in AbstractTrafficShapingHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7fb0a382_898a_53a0_b8c6_333a9bcaaf3e["write()"]
  8335ea87_158a_c21f_4d30_8f254caf2ded["AbstractTrafficShapingHandler"]
  7fb0a382_898a_53a0_b8c6_333a9bcaaf3e -->|defined in| 8335ea87_158a_c21f_4d30_8f254caf2ded
  a91eab56_8f89_970f_38b0_86168fd566bd["calculateSize()"]
  7fb0a382_898a_53a0_b8c6_333a9bcaaf3e -->|calls| a91eab56_8f89_970f_38b0_86168fd566bd
  5546df53_f7c6_1216_f0ef_637a40f2a3fa["isHandlerActive()"]
  7fb0a382_898a_53a0_b8c6_333a9bcaaf3e -->|calls| 5546df53_f7c6_1216_f0ef_637a40f2a3fa
  1bc1935a_f07f_f5c9_b8b1_32159247112d["submitWrite()"]
  7fb0a382_898a_53a0_b8c6_333a9bcaaf3e -->|calls| 1bc1935a_f07f_f5c9_b8b1_32159247112d
  style 7fb0a382_898a_53a0_b8c6_333a9bcaaf3e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java lines 551–570

    @Override
    public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise)
            throws Exception {
        long size = calculateSize(msg);
        long now = TrafficCounter.milliSecondFromNano();
        if (size > 0) {
            // compute the number of ms to wait before continue with the channel
            long wait = trafficCounter.writeTimeToWait(size, writeLimit, maxTime, now);
            if (wait >= MINIMAL_WAIT) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Write suspend: " + wait + ':' + ctx.channel().config().isAutoRead() + ':'
                            + isHandlerActive(ctx));
                }
                submitWrite(ctx, msg, size, wait, now, promise);
                return;
            }
        }
        // to maintain order of write
        submitWrite(ctx, msg, size, 0, now, promise);
    }

Domain

Subdomains

Frequently Asked Questions

What does write() do?
write() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java.
Where is write() defined?
write() is defined in handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java at line 551.
What does write() call?
write() calls 3 function(s): calculateSize, isHandlerActive, submitWrite.

Analyze Your Own Codebase

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

Try Supermodel Free