Package org.jboss.netty.handler.traffic

Implementation of a Traffic Shaping Handler and Dynamic Statistics.

See:
          Description


Class Summary
AbstractTrafficShapingHandler AbstractTrafficShapingHandler allows to limit the global bandwidth (see GlobalTrafficShapingHandler) or per session bandwidth (see ChannelTrafficShapingHandler), as traffic shaping.
ChannelTrafficShapingHandler This implementation of the AbstractTrafficShapingHandler is for channel traffic shaping, that is to say a per channel limitation of the bandwidth.
GlobalTrafficShapingHandler This implementation of the AbstractTrafficShapingHandler is for global traffic shaping, that is to say a global limitation of the bandwidth, whatever the number of opened channels.
TrafficCounter TrafficCounter is associated with AbstractTrafficShapingHandler.
 

Package org.jboss.netty.handler.traffic Description

Implementation of a Traffic Shaping Handler and Dynamic Statistics.


The main goal of this package is to allow to shape the traffic (bandwidth limitation), but also to get statistics on how many bytes are read or written. Both functions can be active or inactive (traffic or statistics).

Two classes implement this behavior:

Standard use could be as follow:



So in your application you will create your own TrafficShapingHandler and set the values to fit your needs.

XXXXXTrafficShapingHandler myHandler = new XXXXXTrafficShapingHandler(timer);

timer could be created using HashedWheelTimer and XXXXX could be either Global or Channel
pipeline.addLast("XXXXX_TRAFFIC_SHAPING", myHandler);
...
pipeline.addLast("MemoryExecutor",new ExecutionHandler(memoryAwareThreadPoolExecutor));

Note that a new ChannelTrafficShapingHandler must be created for each new channel, but only one GlobalTrafficShapingHandler must be created for all channels.

Note also that you can create different GlobalTrafficShapingHandler if you want to separate classes of channels (for instance either from business point of view or from bind address point of view).

Author:
The Netty Project (netty-dev@lists.jboss.org), Frederic Bregier


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.