Example usage for io.netty.handler.traffic GlobalTrafficShapingHandler GlobalTrafficShapingHandler

List of usage examples for io.netty.handler.traffic GlobalTrafficShapingHandler GlobalTrafficShapingHandler

Introduction

In this page you can find the example usage for io.netty.handler.traffic GlobalTrafficShapingHandler GlobalTrafficShapingHandler.

Prototype

public GlobalTrafficShapingHandler(EventExecutor executor) 

Source Link

Document

Create a new instance using default Check Interval value of 1000 ms and default max time as delay allowed value of 15000 ms and no limit.

Usage

From source file:com.mycompany.nettyweb.HttpServerInitializer.java

@Override
public void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline p = ch.pipeline();//from  w ww.  j  a v a  2s. c o  m
    GlobalTrafficShapingHandler globalTrafficShapingHandler = new GlobalTrafficShapingHandler(ch.eventLoop());
    trafficCounter = globalTrafficShapingHandler.trafficCounter();
    trafficCounter.start();

    p.addLast(globalTrafficShapingHandler);
    p.addLast("codec", new HttpServerCodec());
    p.addLast("handler", new HttpServerHandler(trafficCounter, statistics));
}