synchronized void resetAccounting ( long newLastTime ) { long interval = newLastTime - lastTime . getAndSet ( newLastTime ) ; if ( interval == 0 ) { // nothing to do return ; } if ( logger . isDebugEnabled ( ) && interval > checkInterval ( ) << 1 ) { logger . debug ( "Acct schedule not ok: " + interval + " > 2*" + checkInterval ( ) + " from " + name ) ; } lastReadBytes = currentReadBytes . getAndSet ( 0 ) ; lastWrittenBytes = currentWrittenBytes . getAndSet ( 0 ) ; lastReadThroughput = lastReadBytes * 1000 / interval ; // nb byte / checkInterval in ms * 1000 (1s) lastWriteThroughput = lastWrittenBytes * 1000 / interval ; // nb byte / checkInterval in ms * 1000 (1s) realWriteThroughput = realWrittenBytes . getAndSet ( 0 ) * 1000 / interval ; lastWritingTime = Math . max ( lastWritingTime , writingTime ) ; lastReadingTime = Math . max ( lastReadingTime , readingTime ) ; }
Reset the accounting on Read and Write .