Class MutableTimeStatisticImpl
java.lang.Object
com.sun.enterprise.admin.monitor.stats.MutableTimeStatisticImpl
- All Implemented Interfaces:
MutableStatistic,MutableTimeStatistic,Serializable,Statistic,TimeStatistic
An implementation of
MutableTimeStatistic that eases the various
statistical calculations.- Since:
- S1AS8.0
- Version:
- $Revision: 1.2 $
- Author:
- Kedar Mhaswade
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMutableTimeStatisticImpl(TimeStatistic initial) Constructs an instance of this class from its immutable equivalent. -
Method Summary
Modifier and TypeMethodDescriptionlonggetCount()Number of times the operation was invoked since the beginning of this measurement.A human-readable description of the Statistic.longThe time of the last measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.longThe maximum amount of time taken to complete one invocation of this operation since the beginning of this measurement.longThe minimum amount of time taken to complete one invocation of this operation since the beginning of this measurement.getName()The name of this Statistic.longThe time of the first measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.longThis is the sum total of time taken to complete every invocation of this operation since the beginning of this measurement.getUnit()The unit of measurement for this Statistic.voidincrementCount(long current) Increments the count of operation execution by 1 and also increases the time consumed.Returns an instance of Statistic whose state can be changed by the caller.voidreset()Resets the Statistic.voidThis method is the essence of this class.
-
Constructor Details
-
MutableTimeStatisticImpl
Constructs an instance of this class from its immutable equivalent. Note that there are some constraints on the parameter passed:- The maxTime, minTime and totTime of param must be same
- Parameters:
instance- of (immutable)TimeStatistic
-
-
Method Details
-
incrementCount
public void incrementCount(long current) Increments the count of operation execution by 1 and also increases the time consumed. A successful execution of method will have all the data updated as:- method count ++
- max time, min time and total time are accordingly adjusted
- Specified by:
incrementCountin interfaceMutableTimeStatistic- Parameters:
current- long indicating time in whatever unit this statistic is calculated
-
reset
public void reset()Resets the Statistic. Calling this method has following effect:- Initial state of this Statistic is restored as far as Count, Minimum/Maximum and Total time of execution is considered.
- Specified by:
resetin interfaceMutableStatistic
-
unmodifiableView
This method is the essence of this class. Returns the unmodifiable view of this instance.- Specified by:
unmodifiableViewin interfaceMutableStatistic- Returns:
- an instance of
TimeStatistic
-
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.
-
getCount
public long getCount()Description copied from interface:TimeStatisticNumber of times the operation was invoked since the beginning of this measurement.- Specified by:
getCountin interfaceTimeStatistic
-
getDescription
Description copied from interface:StatisticA human-readable description of the Statistic.- Specified by:
getDescriptionin interfaceStatistic
-
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
-
getMaxTime
public long getMaxTime()Description copied from interface:TimeStatisticThe maximum amount of time taken to complete one invocation of this operation since the beginning of this measurement.- Specified by:
getMaxTimein interfaceTimeStatistic
-
getMinTime
public long getMinTime()Description copied from interface:TimeStatisticThe minimum amount of time taken to complete one invocation of this operation since the beginning of this measurement.- Specified by:
getMinTimein interfaceTimeStatistic
-
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
-
getTotalTime
public long getTotalTime()Description copied from interface:TimeStatisticThis is the sum total of time taken to complete every invocation of this operation since the beginning of this measurement. Dividing totalTime by count will give you the average execution time for this operation.- Specified by:
getTotalTimein interfaceTimeStatistic
-
getUnit
Description copied from interface:StatisticThe unit of measurement for this Statistic. Valid values for TimeStatistic measurements are "HOUR", "MINUTE", "SECOND", "MILLISECOND", "MICROSECOND" and "NANOSECOND". -
setDescription
-