Home / Function/ PerChannel() — netty Function Reference

PerChannel() — netty Function Reference

Architecture documentation for the PerChannel() function in GlobalTrafficShapingHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b524ce42_3f71_22cb_1190_0a97828ae14d["PerChannel()"]
  25ae99c4_4bb1_9893_ce25_fa54995d6af1["GlobalTrafficShapingHandler"]
  b524ce42_3f71_22cb_1190_0a97828ae14d -->|defined in| 25ae99c4_4bb1_9893_ce25_fa54995d6af1
  style b524ce42_3f71_22cb_1190_0a97828ae14d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/traffic/GlobalTrafficShapingHandler.java lines 241–255

    private PerChannel getOrSetPerChannel(ChannelHandlerContext ctx) {
        // ensure creation is limited to one thread per channel
        Channel channel = ctx.channel();
        Integer key = channel.hashCode();
        PerChannel perChannel = channelQueues.get(key);
        if (perChannel == null) {
            perChannel = new PerChannel();
            perChannel.messagesQueue = new ArrayDeque<ToSend>();
            perChannel.queueSize = 0L;
            perChannel.lastReadTimestamp = TrafficCounter.milliSecondFromNano();
            perChannel.lastWriteTimestamp = perChannel.lastReadTimestamp;
            channelQueues.put(key, perChannel);
        }
        return perChannel;
    }

Domain

Subdomains

Frequently Asked Questions

What does PerChannel() do?
PerChannel() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/traffic/GlobalTrafficShapingHandler.java.
Where is PerChannel() defined?
PerChannel() is defined in handler/src/main/java/io/netty/handler/traffic/GlobalTrafficShapingHandler.java at line 241.

Analyze Your Own Codebase

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

Try Supermodel Free