List of usage examples for io.netty.handler.traffic TrafficCounter checkInterval
AtomicLong checkInterval
To view the source code for io.netty.handler.traffic TrafficCounter checkInterval.
Click Source Link
From source file:com.nettyhttpserver.server.NettyChannelTrafficShapingHandler.java
private void trafficAccounting() { TrafficCounter tc = trafficCounter(); connectionInfo.setRecivedBytes(Math.abs(tc.cumulativeReadBytes())); connectionInfo.setSentBytes(tc.cumulativeWrittenBytes()); connectionInfo.setSpeed(tc.lastWrittenBytes() * 1000 / (tc.checkInterval())); connectionInfo.setTimestamp(new Timestamp(System.currentTimeMillis())); /*//from w ww .j a va 2 s . c o m * Instance is added to List on last place (the last the newest) */ if (serverConnectionList.contains(connectionInfo)) { serverConnectionList.remove(connectionInfo); addToConnectionList(); } else { addToConnectionList(); } }