Class MutableAverageRangeStatisticImpl

    • Field Detail

      • DEFAULT_MAX_BOUND

        public static final long DEFAULT_MAX_BOUND
        DEFAULT_UPPER_BOUND is maximum value Long can attain
        See Also:
        Constant Field Values
    • Constructor Detail

      • MutableAverageRangeStatisticImpl

        public MutableAverageRangeStatisticImpl​(BoundedRangeStatistic initial)
        Constructs an instance of MutableAverageRangeStatisticImpl that encapsulates the given Statistic. The only parameter denotes the initial state of this statistic. It is guaranteed that the initial state is preserved internally, so that one can reset to the initial state.
        Parameters:
        initial - an instance of BoundedRangeStatistic that represents initial state
    • Method Detail

      • modifiableView

        public Statistic modifiableView()
        Description copied from interface: MutableStatistic
        Returns an instance of Statistic whose state can be changed by the caller. It is important to know that caller should not cache the return value from this method. In general, there is a problem in this contract in that, a client would not know from a Stats.getCreateCount() method whether the return value is something that is being modified or is invariant. Hence the caller should not cache the returned value in a collection and then collectively process it. The main idea behind providing this method is to control the number of instances created (per Mahesh's Suggestion).
        Specified by:
        modifiableView in interface MutableStatistic
        Returns:
        an instance of Statistic interface that should not be cached.
      • reset

        public void reset()
        Description copied from interface: MutableStatistic
        Resets the encapsulated Statistic interface to its initial value. The idea being, if (after creation of the instance) the state changes, the initial state can be easily regained by calling this method. Note that the time of last sampling changes to the instant when this method is invoked.
        Specified by:
        reset in interface MutableStatistic
      • setCount

        public void setCount​(long current)
        Description copied from interface: MutableCountStatistic
        Provides the mutator to the only statistic in the implementing class that changes - Count. It is expected that the count is monotonically increasing on a temporal scale.
        Specified by:
        setCount in interface MutableCountStatistic
        Parameters:
        current - long that specifies the value when measured (sampled).
      • getDescription

        public String getDescription()
        Description copied from interface: Statistic
        A human-readable description of the Statistic.
        Specified by:
        getDescription in interface Statistic
      • getHighWaterMark

        public long getHighWaterMark()
        Description copied from interface: RangeStatistic
        The highest value this attribute has held since the beginning of the measurement.
        Specified by:
        getHighWaterMark in interface RangeStatistic
      • getLastSampleTime

        public long getLastSampleTime()
        Description copied from interface: Statistic
        The time of the last measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.
        Specified by:
        getLastSampleTime in interface Statistic
      • getLowWaterMark

        public long getLowWaterMark()
        Description copied from interface: RangeStatistic
        The lowest value this attribute has held since the beginning of the measurement.
        Specified by:
        getLowWaterMark in interface RangeStatistic
      • getName

        public String getName()
        Description copied from interface: Statistic
        The name of this Statistic.
        Specified by:
        getName in interface Statistic
      • getStartTime

        public long getStartTime()
        Description copied from interface: Statistic
        The time of the first measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.
        Specified by:
        getStartTime in interface Statistic
      • getUnit

        public String getUnit()
        Description copied from interface: Statistic
        The unit of measurement for this Statistic. Valid values for TimeStatistic measurements are "HOUR", "MINUTE", "SECOND", "MILLISECOND", "MICROSECOND" and "NANOSECOND".
        Specified by:
        getUnit in interface Statistic