Class Statistic

  • Direct Known Subclasses:
    StatisticCounter, StatisticDelta, StatisticMaximum, StatisticMinimum, StatisticValue

    public abstract class Statistic
    extends Object
    Base implementation of Statistic

    The following modes is available:

    • VALUE - A statistic with this update mode is a simple value that is a straight forward representation of the updated value.
    • DELTA - A statistic with this update mode is a value that represents the delta between the last two recorded values (or the initial value if two updates have not been recorded). This value can be negative if the delta goes up or down.
    • COUNTER - A statistic with this update mode interprets updates as increments (positive values) or decrements (negative values) to the current value.
    • MAXIMUM - A statistic with this update mode is a value that represents the maximum value amongst the update values applied to this statistic.
    • MINIMUM - A statistic with this update mode is a value that represents the minimum value amongst the update values applied to this statistic.
      • The MAXIMUM and MINIMUM modes are not 100% thread-safe as there can be a lost-update problem. This is on purpose because the performance overhead to ensure atomic updates costs to much on CPU and memory footprint. The other modes are thread-safe.
    • Method Detail

      • updateValue

        public abstract void updateValue​(long newValue)
      • getValue

        public abstract long getValue()
      • isUpdated

        public abstract boolean isUpdated()
        Whether the statistic has been updated one or more times. Notice this is only working for value, maximum and minimum modes.
      • reset

        public abstract void reset()