Class MutableAverageRangeStatisticImpl

java.lang.Object
com.sun.enterprise.admin.monitor.stats.MutableAverageRangeStatisticImpl
All Implemented Interfaces:
AverageRangeStatistic, MutableCountStatistic, MutableStatistic, Serializable, RangeStatistic, Statistic

public class MutableAverageRangeStatisticImpl extends Object implements AverageRangeStatistic, MutableCountStatistic
An implementation of AverageRangeStatistic that provides ways to change the state externally through mutators. Convenience class that is useful for components that gather the statistical data. By merely changing the count (which is a mandatory measurement), rest of the statistical information could be deduced.
Since:
S1AS8.1
Version:
1.0
Author:
Larry White, Kedar Mhaswade
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    DEFAULT_UPPER_BOUND is maximum value Long can attain
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an instance of MutableAverageRangeStatisticImpl that encapsulates the given Statistic.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
     
    long
    The current value of this attribute.
    A human-readable description of the Statistic.
    long
    The highest value this attribute has held since the beginning of the measurement.
    long
    The time of the last measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.
    long
    The lowest value this attribute has held since the beginning of the measurement.
    The name of this Statistic.
    long
    The time of the first measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.
    The unit of measurement for this Statistic.
    Returns an instance of Statistic whose state can be changed by the caller.
    void
    Resets the encapsulated Statistic interface to its initial value.
    void
    setCount(long current)
    Provides the mutator to the only statistic in the implementing class that changes - Count.
    Returns a read-only view of this Statistic.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_MAX_BOUND

      public static final long DEFAULT_MAX_BOUND
      DEFAULT_UPPER_BOUND is maximum value Long can attain
      See Also:
  • Constructor Details

    • 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 Details

    • 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.
    • unmodifiableView

      public Statistic unmodifiableView()
      Description copied from interface: MutableStatistic
      Returns a read-only view of this Statistic. An implementing class has to return the instances of Statistic interfaces defined in
      invalid reference
      javax.management.j2ee.statistic
      and com.sun.enterprise.admin.monitor.stats packages.
      Specified by:
      unmodifiableView in interface MutableStatistic
      Returns:
      an instance of a specific Statistic interface
    • 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).
    • getAverage

      public long getAverage()
      Specified by:
      getAverage in interface AverageRangeStatistic
    • getCurrent

      public long getCurrent()
      Description copied from interface: RangeStatistic
      The current value of this attribute.
      Specified by:
      getCurrent in interface RangeStatistic
    • 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