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:
for an immutable implementation, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_MAX_BOUNDDEFAULT_UPPER_BOUND is maximum value Long can attain
-
Constructor Summary
Constructors Constructor Description MutableAverageRangeStatisticImpl(BoundedRangeStatistic initial)Constructs an instance of MutableAverageRangeStatisticImpl that encapsulates the given Statistic.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAverage()longgetCurrent()The current value of this attribute.StringgetDescription()A human-readable description of the Statistic.longgetHighWaterMark()The highest value this attribute has held since the beginning of the measurement.longgetLastSampleTime()The time of the last measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.longgetLowWaterMark()The lowest value this attribute has held since the beginning of the measurement.StringgetName()The name of this Statistic.longgetStartTime()The time of the first measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.StringgetUnit()The unit of measurement for this Statistic.StatisticmodifiableView()Returns an instance of Statistic whose state can be changed by the caller.voidreset()Resets the encapsulated Statistic interface to its initial value.voidsetCount(long current)Provides the mutator to the only statistic in the implementing class that changes - Count.StatisticunmodifiableView()Returns a read-only view of this Statistic.
-
-
-
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:MutableStatisticReturns 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:
modifiableViewin interfaceMutableStatistic- Returns:
- an instance of Statistic interface that should not be cached.
-
unmodifiableView
public Statistic unmodifiableView()
Description copied from interface:MutableStatisticReturns a read-only view of this Statistic. An implementing class has to return the instances of Statistic interfaces defined injavax.management.j2ee.statisticandcom.sun.enterprise.admin.monitor.statspackages.- Specified by:
unmodifiableViewin interfaceMutableStatistic- Returns:
- an instance of a specific Statistic interface
-
reset
public void reset()
Description copied from interface:MutableStatisticResets 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:
resetin interfaceMutableStatistic
-
setCount
public void setCount(long current)
Description copied from interface:MutableCountStatisticProvides 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:
setCountin interfaceMutableCountStatistic- Parameters:
current- long that specifies the value when measured (sampled).
-
getAverage
public long getAverage()
- Specified by:
getAveragein interfaceAverageRangeStatistic
-
getCurrent
public long getCurrent()
Description copied from interface:RangeStatisticThe current value of this attribute.- Specified by:
getCurrentin interfaceRangeStatistic
-
getDescription
public String getDescription()
Description copied from interface:StatisticA human-readable description of the Statistic.- Specified by:
getDescriptionin interfaceStatistic
-
getHighWaterMark
public long getHighWaterMark()
Description copied from interface:RangeStatisticThe highest value this attribute has held since the beginning of the measurement.- Specified by:
getHighWaterMarkin interfaceRangeStatistic
-
getLastSampleTime
public long getLastSampleTime()
Description copied from interface:StatisticThe 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:
getLastSampleTimein interfaceStatistic
-
getLowWaterMark
public long getLowWaterMark()
Description copied from interface:RangeStatisticThe lowest value this attribute has held since the beginning of the measurement.- Specified by:
getLowWaterMarkin interfaceRangeStatistic
-
getName
public String getName()
Description copied from interface:StatisticThe name of this Statistic.
-
getStartTime
public long getStartTime()
Description copied from interface:StatisticThe 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:
getStartTimein interfaceStatistic
-
-