Class TimeWindowStatisticsImpl.Builder<V>

  • Enclosing class:
    TimeWindowStatisticsImpl

    static class TimeWindowStatisticsImpl.Builder<V>
    extends java.lang.Object
    Builder of time window statistics.
    • Field Detail

      • interval

        private final long interval
        Total interval for which these statistics are calculated (eg. last 15 seconds, last one minute) converted to ms
    • Constructor Detail

      • Builder

        Builder​(TimeReservoir<V> timeReservoir)
        Create new time window statistics builder instance.
        Parameters:
        timeReservoir - statistically representative reservoir of long values data stream in time.
    • Method Detail

      • addRequest

        void addRequest​(long requestTime,
                        V duration)
        Add request execution.
        Parameters:
        requestTime - Time of execution.
        duration - Duration of request processing.
      • build

        TimeWindowStatisticsImpl build()
        Build the time window statistics instance.
        Returns:
        New instance of statistics.
      • build

        TimeWindowStatisticsImpl build​(long currentTime)
        Build the time window statistics instance.
        Parameters:
        currentTime - Current time as a reference to which the statistics should be built.
        Returns:
        New instance of statistics.
      • getInterval

        public long getInterval()