List of usage examples for io.netty.handler.traffic GlobalTrafficShapingHandler trafficCounter
public TrafficCounter trafficCounter()
From source file:com.mycompany.nettyweb.HttpServerInitializer.java
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline p = ch.pipeline();/*from ww w.ja 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)); }
From source file:de.jackwhite20.apex.command.impl.StatsCommand.java
License:Open Source License
@Override public boolean execute(String[] args) { logger.info("Connections: {}", Apex.getChannelGroup().size()); if (Apex.getInstance().getConnectionsPerSecondTask() != null) { logger.info("Connections per second: {}", Apex.getInstance().getConnectionsPerSecondTask().getPerSecond()); }/*from www . j a v a 2 s . com*/ logger.info("Online backend servers: {}", Apex.getBalancingStrategy().size()); GlobalTrafficShapingHandler trafficShapingHandler = Apex.getInstance().getTrafficShapingHandler(); if (trafficShapingHandler != null) { TrafficCounter trafficCounter = trafficShapingHandler.trafficCounter(); logger.info("Current bytes read: {}", trafficCounter.currentReadBytes()); logger.info("Current bytes written: {}", trafficCounter.currentWrittenBytes()); logger.info("Last read throughput: {}", trafficCounter.lastReadThroughput()); logger.info("Last write throughput: {}", trafficCounter.lastWrittenBytes()); logger.info("Total bytes read: {}", trafficCounter.cumulativeReadBytes()); logger.info("Total bytes written: {}", trafficCounter.cumulativeWrittenBytes()); } return true; }