Class SamplingAgeManager.TimeBasedAgeManager

  • Enclosing class:
    SamplingAgeManager

    public static class SamplingAgeManager.TimeBasedAgeManager
    extends SamplingAgeManager
    This manages time based storage throttling. The trick to this class is that it's all based on the timestamps of the values that pass through, so that no matter how the data flows, we adhere to the expectation defined by the settings.
    • Field Detail

      • clock

        public static java.time.Clock clock
    • Constructor Detail

      • TimeBasedAgeManager

        public TimeBasedAgeManager​(java.time.Clock testClock,
                                   long maxMS,
                                   long minMS)
      • TimeBasedAgeManager

        public TimeBasedAgeManager​(long maxMS,
                                   long minMS)
    • Method Detail

      • markNoValuesAndCheckAge

        public boolean markNoValuesAndCheckAge()
        Description copied from class: SamplingAgeManager
        Returns whether values should be stored due to max age. The caller should then call markValuesStored() after to let it know that values where stored.
        Specified by:
        markNoValuesAndCheckAge in class SamplingAgeManager
      • checkMinAge

        public long checkMinAge​(java.util.List<HistoricalTagValue> values)
        Description copied from class: SamplingAgeManager
        Evaluates the min age setting, holding the values as pending and returning a long indicting the milliseconds until expiration, if applicable. If the return is <=0, the values can be stored.
        Specified by:
        checkMinAge in class SamplingAgeManager
      • markValuesStored

        public void markValuesStored​(java.util.Date lastTS)
        Description copied from class: SamplingAgeManager
        Should be called any time values are stored in order to reset any bookkeeping. *
        Specified by:
        markValuesStored in class SamplingAgeManager
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object