public void updateThroughput(long currentTime){
  throughputCalculationLock.lock();
  try {
    int interval=(int)(currentTime - lastThroughputCalculationTime);
    long minInterval=getThroughputCalculationIntervalInMillis();
    if ((minInterval == 0) || (interval < minInterval)) {
      return;
    }
    long readBytes=this.readBytes;
    long writtenBytes=this.writtenBytes;
    long readMessages=this.readMessages;
    long writtenMessages=this.writtenMessages;
    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;
  }
  finally {
    throughputCalculationLock.unlock();
  }
}

public void updateThroughput ( long currentTime ) { throughputCalculationLock . lock ( ) ; try { int interval = ( int ) ( currentTime - lastThroughputCalculationTime ) ; long minInterval = getThroughputCalculationIntervalInMillis ( ) ; if ( ( minInterval == 0 ) || ( interval < minInterval ) ) { return ; } long readBytes = this . readBytes ; long writtenBytes = this . writtenBytes ; long readMessages = this . readMessages ; long writtenMessages = this . writtenMessages ; 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 ; } finally { throughputCalculationLock . unlock ( ) ; } }
updates the throughput counters .
