Class SlidingWindowTimeReservoir

    • Constructor Summary

      Constructors 
      Constructor Description
      SlidingWindowTimeReservoir​(long window, java.util.concurrent.TimeUnit windowUnit, long startTime, java.util.concurrent.TimeUnit startTimeUnit)
      Creates a new sliding window time reservoir with the start time, specified time window and a default trimmer.
      SlidingWindowTimeReservoir​(long window, java.util.concurrent.TimeUnit windowUnit, long startTime, java.util.concurrent.TimeUnit startTimeUnit, SlidingWindowTrimmer<java.lang.Long> trimmer)
      Creates a new sliding window time reservoir with the start time, specified time window and a custom trimmer.
    • Constructor Detail

      • SlidingWindowTimeReservoir

        public SlidingWindowTimeReservoir​(long window,
                                          java.util.concurrent.TimeUnit windowUnit,
                                          long startTime,
                                          java.util.concurrent.TimeUnit startTimeUnit,
                                          SlidingWindowTrimmer<java.lang.Long> trimmer)
        Creates a new sliding window time reservoir with the start time, specified time window and a custom trimmer.
        Parameters:
        window - The window of startTime.
        windowUnit - The unit of window.
        startTime - The start time from which this reservoir calculates measurements.
        startTimeUnit - The start time unit.
        trimmer - The trimmer to use for trimming, if null, default trimmer is used.
      • SlidingWindowTimeReservoir

        public SlidingWindowTimeReservoir​(long window,
                                          java.util.concurrent.TimeUnit windowUnit,
                                          long startTime,
                                          java.util.concurrent.TimeUnit startTimeUnit)
        Creates a new sliding window time reservoir with the start time, specified time window and a default trimmer.
        Parameters:
        window - The window of startTime.
        windowUnit - The unit of window.
        startTime - The start time from which this reservoir calculates measurements.
        startTimeUnit - The start time unit.
    • Method Detail

      • snapshot

        protected UniformTimeSnapshot snapshot​(java.util.Collection<java.lang.Long> values,
                                               long timeInterval,
                                               java.util.concurrent.TimeUnit timeIntervalUnit,
                                               long time,
                                               java.util.concurrent.TimeUnit timeUnit)
        Description copied from class: AbstractSlidingWindowTimeReservoir
        Subclasses are required to instantiate UniformTimeSnapshot on their own.
        Specified by:
        snapshot in class AbstractSlidingWindowTimeReservoir<java.lang.Long>
        Parameters:
        values - The values to create the snapshot from
        timeInterval - The time interval this snapshot conforms to
        timeIntervalUnit - The interval unit of the time interval
        time - The time of the request of the snapshot
        timeUnit - The unit of the time of the snapshot request
        Returns:
        The snapshot