com.sun.enterprise.admin.monitor.stats
Class MutableAverageRangeStatisticImpl

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

public class MutableAverageRangeStatisticImpl
extends Object
implements AverageRangeStatistic, MutableCountStatistic

Author:
lwhite
See Also:
Serialized Form

Field Summary
static long DEFAULT_MAX_BOUND
          DEFAULT_UPPER_BOUND is maximum value Long can attain
 
Constructor Summary
MutableAverageRangeStatisticImpl(BoundedRangeStatistic initial)
          Constructs an instance of MutableAverageRangeStatisticImpl that encapsulates the given Statistic.
 
Method Summary
 long getAverage()
           
 long getCurrent()
          The current value of this attribute.
 String getDescription()
          A human-readable description of the Statistic.
 long getHighWaterMark()
          The highest value this attribute has held since the beginning of the measurement.
 long getLastSampleTime()
          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 getLowWaterMark()
          The lowest value this attribute has held since the beginning of the measurement.
 String getName()
          The name of this Statistic.
 long getStartTime()
          The time of the first measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.
 String getUnit()
          The unit of measurement for this Statistic.
 Statistic modifiableView()
          Returns an instance of Statistic whose state can be changed by the caller.
 void reset()
          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.
 Statistic unmodifiableView()
          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 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.

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


Copyright © 2012. All Rights Reserved.