protected void updateRates ( QueueStatMeasurements rateMeasurements , long dequeueCountDelta , long enqueueCountDelta ) { double oldDequeueRateOneMinute = rateMeasurements . messageRates . getOneMinuteAverageDequeueRate ( ) ; double oldDequeueRateOneHour = rateMeasurements . messageRates . getOneHourAverageDequeueRate ( ) ; double oldDequeueRateOneDay = rateMeasurements . messageRates . getOneDayAverageDequeueRate ( ) ; double oldEnqueueRateOneMinute = rateMeasurements . messageRates . getOneMinuteAverageEnqueueRate ( ) ; double oldEnqueueRateOneHour = rateMeasurements . messageRates . getOneHourAverageEnqueueRate ( ) ; double oldEnqueueRateOneDay = rateMeasurements . messageRates . getOneDayAverageEnqueueRate ( ) ; // // Protect against negative changes in Enqueue and Dequeue counts - these metrics are designed to only ever // increase, but can reset in cases such as restarting a broker and manually resetting the statistics through // JMX controls. // if ( dequeueCountDelta < 0 ) { this . log . debug ( "detected negative change in dequeue count; ignoring: queue={}; delta={}" , this . queueName , dequeueCountDelta ) ; dequeueCountDelta = 0 ; } if ( enqueueCountDelta < 0 ) { this . log . debug ( "detected negative change in enqueue count; ignoring: queue={}; delta={}" , this . queueName , enqueueCountDelta ) ; enqueueCountDelta = 0 ; } // // Update the rates and add in the changes. // rateMeasurements . messageRates . onTimestampSample ( statsClock . getStatsStopWatchTime ( ) , dequeueCountDelta , enqueueCountDelta ) ; aggregateDequeueRateOneMinute -= oldDequeueRateOneMinute ; aggregateDequeueRateOneMinute += rateMeasurements . messageRates . getOneMinuteAverageDequeueRate ( ) ; aggregateDequeueRateOneHour -= oldDequeueRateOneHour ; aggregateDequeueRateOneHour += rateMeasurements . messageRates . getOneHourAverageDequeueRate ( ) ; aggregateDequeueRateOneDay -= oldDequeueRateOneDay ; aggregateDequeueRateOneDay += rateMeasurements . messageRates . getOneDayAverageDequeueRate ( ) ; aggregateEnqueueRateOneMinute -= oldEnqueueRateOneMinute ; aggregateEnqueueRateOneMinute += rateMeasurements . messageRates . getOneMinuteAverageEnqueueRate ( ) ; aggregateEnqueueRateOneHour -= oldEnqueueRateOneHour ; aggregateEnqueueRateOneHour += rateMeasurements . messageRates . getOneHourAverageEnqueueRate ( ) ; aggregateEnqueueRateOneDay -= oldEnqueueRateOneDay ; aggregateEnqueueRateOneDay += rateMeasurements . messageRates . getOneDayAverageEnqueueRate ( ) ; }
Update message rates given the change in dequeue and enqueue counts for one broker queue .