Example usage for io.netty.handler.traffic TrafficCounter lastCumulativeTime

List of usage examples for io.netty.handler.traffic TrafficCounter lastCumulativeTime

Introduction

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

Prototype

long lastCumulativeTime

To view the source code for io.netty.handler.traffic TrafficCounter lastCumulativeTime.

Click Source Link

Document

Last Time where cumulative bytes where reset to zero: this time is a real EPOC time (informative only)

Usage

From source file:testserver.StatisticHandler.java

License:Apache License

@Override
public void close(ChannelHandlerContext ctx, ChannelPromise future) throws Exception {
    TrafficCounter tc = this.trafficCounter();
    requestInfo.add((Long) tc.cumulativeReadBytes());
    requestInfo.add((Long) tc.cumulativeWrittenBytes());
    requestInfo.add((Long) (tc.cumulativeReadBytes() + tc.cumulativeWrittenBytes()) * 1000
            / (System.currentTimeMillis() - tc.lastCumulativeTime()));
    Statistic.addFullQuery(requestInfo);
    Statistic.opened -= 1;/*from   w  w  w. j a v  a2s.  c  om*/
    super.close(ctx, future);
}