MultiWindowRate implements ReadableMultiWindowRate, WritableMultiWindowStat { @Override public void add(long delta) { rollCurrentIfNeeded(); currentCounter.add(delta); } MultiWindowRate(int timeBucketSizeMillis);   MultiWindowRate(
      CompositeSum allTimeCounter,
      CompositeSum hourCounter,
      CompositeSum tenMinuteCounter,
      CompositeSum minuteCounter,
      ReadableDateTime start,
      int timeBucketSizeMillis);  MultiWindowRate(); @Override void add(long delta); @Override long getMinuteSum(); @Override long getMinuteRate(); @Override long getTenMinuteSum(); @Override long getTenMinuteRate(); @Override long getHourSum(); @Override long getHourRate(); @Override long getAllTimeSum(); @Override long getAllTimeRate(); MultiWindowRate merge(MultiWindowRate rate);  }
@Test(groups = "fast") public void testRates() throws Exception { MultiWindowRate rate = new MultiWindowRate(); long initialValue = 60000; long rate30Seconds = initialValue / 30; long rate60Seconds = initialValue / 60; long rate2Minutes = initialValue / 120; long rate11Minutes = initialValue / 660; long rate60Minutes = initialValue / 3600; long rate120Minutes = initialValue / 7200; assertRateValues(rate, 0, 0, 0, 0); advanceNowSeconds(30); rate.add(initialValue); assertRateValues(rate, rate30Seconds, rate30Seconds, rate30Seconds, rate30Seconds); advanceNowSeconds(30); assertRateValues(rate, rate60Seconds, rate60Seconds, rate60Seconds, rate60Seconds); advanceNowMinutes(1); assertRateValues(rate, 0, rate2Minutes, rate2Minutes, rate2Minutes); advanceNowMinutes(9); assertRateValues(rate, 0, 0, rate11Minutes, rate11Minutes); advanceNowMinutes(49); assertRateValues(rate, 0, 0, rate60Minutes, rate60Minutes); advanceNowMinutes(60); assertRateValues(rate, 0, 0, 0, rate120Minutes); rate.add(initialValue); assertRateValues( rate, initialValue / 60, initialValue / 600, initialValue / 3600, 2 * initialValue / 7200); }