public void updateThroughput ( long currentTime ) { synchronized ( throughputCalculationLock ) { int interval = ( int ) ( currentTime - lastThroughputCalculationTime ) ; long minInterval = getThroughputCalculationIntervalInMillis ( ) ; if ( minInterval == 0 || interval < minInterval ) { return ; } long readBytes = this . readBytes . get ( ) ; long writtenBytes = this . writtenBytes . get ( ) ; long readMessages = this . readMessages . get ( ) ; long writtenMessages = this . writtenMessages . get ( ) ; readBytesThroughput = ( readBytes - lastReadBytes ) * 1000.0 / interval ; writtenBytesThroughput = ( writtenBytes - lastWrittenBytes ) * 1000.0 / interval ; readMessagesThroughput = ( readMessages - lastReadMessages ) * 1000.0 / interval ; writtenMessagesThroughput = ( writtenMessages - lastWrittenMessages ) * 1000.0 / interval ; if ( readBytesThroughput > largestReadBytesThroughput ) { largestReadBytesThroughput = readBytesThroughput ; } if ( writtenBytesThroughput > largestWrittenBytesThroughput ) { largestWrittenBytesThroughput = writtenBytesThroughput ; } if ( readMessagesThroughput > largestReadMessagesThroughput ) { largestReadMessagesThroughput = readMessagesThroughput ; } if ( writtenMessagesThroughput > largestWrittenMessagesThroughput ) { largestWrittenMessagesThroughput = writtenMessagesThroughput ; } lastReadBytes = readBytes ; lastWrittenBytes = writtenBytes ; lastReadMessages = readMessages ; lastWrittenMessages = writtenMessages ; lastThroughputCalculationTime = currentTime ; } }
Updates the throughput counters .