Bucket currentBucket = buckets.peekLast(); if (currentBucket != null && currentTime < currentBucket.windowStart + this.bucketSizeInMillseconds) { if (buckets.peekLast() == null) { Bucket lastBucket = buckets.peekLast(); if (currentTime < lastBucket.windowStart + this.bucketSizeInMillseconds) { return buckets.peekLast(); currentBucket = buckets.peekLast(); if (currentBucket != null) {
Bucket currentBucket = buckets.peekLast(); if (currentBucket != null && currentTime < currentBucket.windowStart + this.bucketSizeInMillseconds) { if (buckets.peekLast() == null) { Bucket lastBucket = buckets.peekLast(); if (currentTime < lastBucket.windowStart + this.bucketSizeInMillseconds) { return buckets.peekLast(); currentBucket = buckets.peekLast(); if (currentBucket != null) {
/** * Force a reset of all rolling counters (clear all buckets) so that statistics start being gathered from scratch. * <p> * This does NOT reset the CumulativeSum values. */ public void reset() { // if we are resetting, that means the lastBucket won't have a chance to be captured in CumulativeSum, so let's do it here Bucket lastBucket = buckets.peekLast(); if (lastBucket != null) { cumulativeSum.addBucket(lastBucket); } // clear buckets so we start over again buckets.clear(); }
public Bucket getLast() { return peekLast(); }
public Bucket getLast() { return peekLast(); }
/** * Force a reset of all rolling counters (clear all buckets) so that statistics start being gathered from scratch. * <p> * This does NOT reset the CumulativeSum values. */ public void reset() { // if we are resetting, that means the lastBucket won't have a chance to be captured in CumulativeSum, so let's do it here Bucket lastBucket = buckets.peekLast(); if (lastBucket != null) { cumulativeSum.addBucket(lastBucket); } // clear buckets so we start over again buckets.clear(); }