FileDocCategorySizeDatePackage
StatsImpl.javaAPI DocGlassfish v2 API4503Fri May 04 22:24:46 BST 2007com.sun.enterprise.admin.wsmgmt.stats.impl

StatsImpl

public abstract class StatsImpl extends Object implements javax.management.j2ee.statistics.Stats
Base class for all the StatsImpl. Also provides a couple of methods for MonitorListener
author
Satish Viswanatham

Fields Summary
protected static final Logger
_logger
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
genericStatsDelegate
protected boolean
monitorOn
protected boolean
registered
private com.sun.enterprise.admin.monitor.registry.MonitoringLevel
currentMonitoringLevel
Constructors Summary
protected StatsImpl()


      
    
Methods Summary
public javax.management.j2ee.statistics.StatisticgetStatistic(java.lang.String statName)

	return genericStatsDelegate.getStatistic(statName);
    
public java.lang.String[]getStatisticNames()

	return genericStatsDelegate.getStatisticNames();
    
public javax.management.j2ee.statistics.Statistic[]getStatistics()

	return genericStatsDelegate.getStatistics();
    
protected voidinitialize(java.lang.String statInterfaceName)

	try {
	    genericStatsDelegate =  new GenericStatsImpl(statInterfaceName, this);
	} catch(ClassNotFoundException cnfEx) {
	    throw new RuntimeException(statInterfaceName + " not found", cnfEx);
	}
    
public java.lang.StringstatToString()

	StringBuffer sbuf = new StringBuffer();
	Statistic[] stats = getStatistics();
	int sz = stats.length;
	for (int i=0; i<sz; i++) {
	    if (stats[i] instanceof CountStatistic) {
		CountStatistic stat = (CountStatistic) stats[i];
		sbuf.append(stat.getName()).append("=")
		    .append(stat.getCount()).append("; ");
	    } else if (stats[i]  instanceof BoundedRangeStatistic) {
		BoundedRangeStatistic stat = (BoundedRangeStatistic) stats[i];
		sbuf.append(stat.getName()).append("=")
		    .append(stat.getCurrent()).append("; ");
	    } else {
		sbuf.append(stats[i].getName()).append("=?");
	    }
	}

	return sbuf.toString();