Uses of Class
io.netty.handler.traffic.AbstractTrafficShapingHandler
-
Packages that use AbstractTrafficShapingHandler Package Description io.netty.handler.traffic Implementation of a Traffic Shaping Handler and Dynamic Statistics. -
-
Uses of AbstractTrafficShapingHandler in io.netty.handler.traffic
Subclasses of AbstractTrafficShapingHandler in io.netty.handler.traffic Modifier and Type Class Description classChannelTrafficShapingHandlerThis implementation of theAbstractTrafficShapingHandleris for channel traffic shaping, that is to say a per channel limitation of the bandwidth.classGlobalChannelTrafficShapingHandlerThis implementation of theAbstractTrafficShapingHandleris for global and per channel traffic shaping, that is to say a global limitation of the bandwidth, whatever the number of opened channels and a per channel limitation of the bandwidth.
This version shall not be in the same pipeline than other TrafficShapingHandler.
The general use should be as follow:
Create your unique GlobalChannelTrafficShapingHandler like:
GlobalChannelTrafficShapingHandler myHandler = new GlobalChannelTrafficShapingHandler(executor);
The executor could be the underlying IO worker pool
pipeline.addLast(myHandler);
Note that this handler has a Pipeline Coverage of "all" which means only one such handler must be created and shared among all channels as the counter must be shared among all channels.
Other arguments can be passed like write or read limitation (in bytes/s where 0 means no limitation) or the check interval (in millisecond) that represents the delay between two computations of the bandwidth and so the call back of the doAccounting method (0 means no accounting at all).
Note that as this is a fusion of both Global and Channel Traffic Shaping, limits are in 2 sets, respectively Global and Channel.
A value of 0 means no accounting for checkInterval.classGlobalTrafficShapingHandlerThis implementation of theAbstractTrafficShapingHandleris for global traffic shaping, that is to say a global limitation of the bandwidth, whatever the number of opened channels.Constructors in io.netty.handler.traffic with parameters of type AbstractTrafficShapingHandler Constructor Description TrafficCounter(AbstractTrafficShapingHandler trafficShapingHandler, java.util.concurrent.ScheduledExecutorService executor, java.lang.String name, long checkInterval)Constructor with theAbstractTrafficShapingHandlerthat hosts it, the Timer to use, its name, the checkInterval between two computations in millisecond.
-