code: private void cleanUsingTime(final String metricName, final Date firstAllowedDate) {
      if (this.historyListMapping.containsKey(metricName)
          && this.historyListMapping.get(metricName) != null) {
        synchronized (this.historyListMapping.get(metricName)) {
  
          InMemoryHistoryNode firstNode = this.historyListMapping.get(metricName).peekFirst();
          long localCopyOfTimeWindow = 0;
  
          // go ahead for clean up using latest possible value of interval
          // any interval change will not affect on going clean up
          synchronized (this) {
            localCopyOfTimeWindow = this.timeWindow;
          }
  
          // removing objects older than Interval time from firstAllowedDate
          while (firstNode != null
              && TimeUnit.MILLISECONDS
              .toMillis(firstAllowedDate.getTime() - firstNode.getTimestamp().getTime())
              > localCopyOfTimeWindow) {
            this.historyListMapping.get(metricName).removeFirst();
            firstNode = this.historyListMapping.get(metricName).peekFirst();
          }
        }
      }
    }
docs: Remove snapshots to maintain reporting interval
  
  @param metricName Name of the metric
  @param firstAllowedDate End date of the interval