FileDocCategorySizeDatePackage
EJBMethodStatsImpl.javaAPI DocGlassfish v2 API5017Fri May 04 22:32:56 BST 2007com.sun.ejb.base.stats

EJBMethodStatsImpl

public class EJBMethodStatsImpl extends StatsImpl implements com.sun.enterprise.admin.monitor.stats.EJBMethodStats
A Class for providing stats for Bean Methods Used by both Entity, Stateless and Stateful Container
author
Mahesh Kannan

Fields Summary
private MethodMonitor
delegate
private MethodMonitor
methodMonitor
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
executionStat
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
errorStat
private com.sun.enterprise.admin.monitor.stats.MutableTimeStatisticImpl
methodStat
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
successStat
Constructors Summary
public EJBMethodStatsImpl(MethodMonitor delegate)

	this.delegate = delegate;

	initialize();
    
Methods Summary
public javax.management.j2ee.statistics.CountStatisticgetExecutionTime()

	executionStat.setCount(delegate.getExecutionTime());
	return (CountStatistic) executionStat.modifiableView();
    
public javax.management.j2ee.statistics.TimeStatisticgetMethodStatistic()

	return (TimeStatistic) methodStat.modifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetTotalNumErrors()

	errorStat.setCount(delegate.getTotalNumErrors());
	return (CountStatistic) errorStat.modifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetTotalNumSuccess()

	successStat.setCount(delegate.getTotalNumSuccess());
	return (CountStatistic) successStat.modifiableView();
    
private voidinitialize()

	super.initialize("com.sun.enterprise.admin.monitor.stats.EJBMethodStats");

	executionStat = new MutableCountStatisticImpl(
		new CountStatisticImpl("ExecutionTime", "Milliseconds" ));
	errorStat = new MutableCountStatisticImpl(
		new CountStatisticImpl("TotalNumErrors"));

	long now = System.currentTimeMillis();
	methodStat = new MutableTimeStatisticImpl(
		new TimeStatisticImpl(0, 0, 0, 0,
		    "MethodStatistic", "", "", now, now));
	successStat = new MutableCountStatisticImpl(
		new CountStatisticImpl("TotalNumSuccess"));

	delegate.setMutableTimeStatisticImpl(methodStat);
    
protected voidresetAllStats()

	//Implementations must override this to reset stat values

	executionStat.reset();
	errorStat.reset();
	synchronized (methodStat) {
	    methodStat.reset();
	}
	successStat.reset();

	delegate.resetAllStats(monitorOn);