FileDocCategorySizeDatePackage
CountStatisticImpl.javaAPI DocGlassfish v2 API7148Fri May 04 22:25:48 BST 2007com.sun.enterprise.admin.monitor.stats

CountStatisticImpl

public class CountStatisticImpl extends StatisticImpl implements javax.management.j2ee.statistics.CountStatistic
An implementation of a CountStatistic. All instances of this class are immutable. Provides all the necessary accessors for properties.
author
Muralidhar Vempaty
author
Kedar Mhaswade
since
S1AS8.0
verison
1.0

Fields Summary
private long
count
private static final com.sun.enterprise.util.i18n.StringManager
localStrMgr
Constructors Summary
public CountStatisticImpl(String name)
Constructs an instance of this class with following default values:
  • Unit is empty string.
  • Current Value is StatisticImpl#DEFAULT_VALUE.
  • Description is calculated from the name passed in. This may well be read from a properties file to address i18n.
  • LastSampleTime is time at the time of calling this method.
  • StartTime is the same as LastSampleTime.

param
name String indicating the name of the statistic


	           	     	     	                     	          	         				      	 
	   
		this(name, DEFAULT_UNIT);
	
public CountStatisticImpl(String name, String unit)
Constructs an instance of this class with following default values:
  • Current Value is StatisticImpl#DEFAULT_VALUE.
  • Description is calculated from the name passed in. This may well be read from a properties file to address i18n.
  • LastSampleTime is time at the time of calling this method.
  • StartTime is the same as LastSampleTime.

param
name String indicating the name of the statistic
param
unit String indicating the unit of the statistic

		this(name, unit, DEFAULT_VALUE);
	
public CountStatisticImpl(String name, String unit, String desc)
Constructs an instance of this class with following default values:
  • Description is calculated from the name passed in. This may well be read from a properties file to address i18n.
  • LastSampleTime is time at the time of calling this method.
  • StartTime is the same as LastSampleTime.

param
name String indicating the name of the statistic
param
unit String indicating the unit of the statistic
param
desc A brief description of the statistic

		this(DEFAULT_VALUE, name, unit, desc, Util.getInitTime()[0], Util.getInitTime()[1]);
	
public CountStatisticImpl(String name, String unit, long value)
Constructs an instance of this class with following default values:
  • Description is calculated from the name passed in. This may well be read from a properties file to address i18n.
  • LastSampleTime is time at the time of calling this method.
  • StartTime is the same as LastSampleTime.

param
name String indicating the name of the statistic
param
unit String indicating the unit of the statistic
param
value long indicating the unit of the statistic

		this(value, name, unit, Util.getDescriptionFromName(name), Util.getInitTime()[0], Util.getInitTime()[1]);
	
public CountStatisticImpl(long countVal, String name, String unit, String desc, long sampleTime, long startTime)
Constructs an immutable instance of CountStatistic with given parameters.

param
curVal The current value of this statistic
param
name The name of the statistic
param
unit The unit of measurement for this statistic
param
desc A brief description of the statistic
param
startTime Time in milliseconds at which the measurement was started
param
sampleTime Time at which the last measurement was done.

        
        super(name, unit, desc, startTime, sampleTime);
        count = countVal; 
    
Methods Summary
public longgetCount()
Returns the current value of this statistic.

return
long indicating current value

        return count;
    
public java.lang.StringtoString()

        return super.toString() + NEWLINE + "Count: " + getCount();