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

StatefulSessionStoreStatsImpl

public class StatefulSessionStoreStatsImpl extends StatsImpl implements com.sun.enterprise.admin.monitor.stats.StatefulSessionStoreStats
Implementation of StatefulSessionStoreStats There is once instance of this class per StatefulEJBContainer
author
Mahesh Kannan

Fields Summary
private com.sun.ejb.spi.stats.MonitorableSFSBStoreManager
provider
private com.sun.enterprise.admin.monitor.stats.MutableBoundedRangeStatisticImpl
currentSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
activationCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
activationSuccessCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
activationErrorCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
passivationCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
passivationSuccessCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
passivationErrorCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
expiredSessionCount
private com.sun.enterprise.admin.monitor.stats.MutableAverageRangeStatisticImpl
activationSize
private com.sun.enterprise.admin.monitor.stats.MutableAverageRangeStatisticImpl
activationTime
private com.sun.enterprise.admin.monitor.stats.MutableAverageRangeStatisticImpl
passivationSize
private com.sun.enterprise.admin.monitor.stats.MutableAverageRangeStatisticImpl
passivationTime
private Object
currentSizeLock
private Object
activationCountLock
private Object
activationSizeLock
private Object
activationTimeLock
private Object
passivationCountLock
private Object
passivationSizeLock
private Object
passivationTimeLock
private Object
expiredSessionCountLock
private long
activationCountVal
private long
activationSuccessCountVal
private long
activationErrorCountVal
private long
passivationCountVal
private long
passivationSuccessCountVal
private long
passivationErrorCountVal
private long
expiredSessionCountVal
Constructors Summary
public StatefulSessionStoreStatsImpl(com.sun.ejb.spi.stats.MonitorableSFSBStoreManager provider)


     
	 
    
	this.provider = provider;
	super.initialize("com.sun.enterprise.admin.monitor.stats.StatefulSessionStoreStats");

	initialize();
    
protected StatefulSessionStoreStatsImpl(com.sun.ejb.spi.stats.MonitorableSFSBStoreManager provider, String intfName)

	this.provider = provider;
	super.initialize(intfName);
    
Methods Summary
protected voidappendStats(java.lang.StringBuffer sbuf)

	sbuf.append("currentSize=").append(provider.getCurrentStoreSize())
	    .append("; ")
	    .append("ActivationCount=").append(activationCountVal)
	    .append("; ")
	    .append("ActivationSuccessCount=").append(activationSuccessCountVal)
	    .append("; ")
	    .append("ActivationErrorCount=").append(activationErrorCountVal)
	    .append("; ")
	    .append("PassivationCount=").append(passivationCountVal)
	    .append("; ")
	    .append("PassivationSuccessCount=").append(passivationSuccessCountVal)
	    .append("; ")
	    .append("PassivationErrorCount=").append(passivationErrorCountVal)
	    .append("; ")
	    .append("ExpiredSessionsRemoved=").append(expiredSessionCountVal)
	    .append("; ");

	appendTimeStatistic(sbuf, "ActivationSize", activationSize);
	appendTimeStatistic(sbuf, "ActivationTime", activationTime);
	appendTimeStatistic(sbuf, "PassivationSize", passivationSize);
	appendTimeStatistic(sbuf, "PassivationTime", passivationTime);

	//Do not call provider.appendStats(). It is called from
	//  MonitoringRegistryMediator so that all undocumented
	//  features are grouped together
    
protected static voidappendTimeStatistic(java.lang.StringBuffer sbuf, java.lang.String name, com.sun.enterprise.admin.monitor.stats.MutableAverageRangeStatisticImpl stat)

	sbuf.append(name).append("(")
	    .append("min=").append(stat.getLowWaterMark()).append(", ")
	    .append("max=").append(stat.getHighWaterMark()).append(", ")
	    .append("avg=").append(stat.getAverage())
	    .append("); ");
    
public com.sun.enterprise.admin.monitor.stats.AverageRangeStatisticgetActivatedBeanSize()
Returns the total number of bytes activated by this store including total, min, maximum

	synchronized (activationSizeLock) {
	    return (AverageRangeStatistic) activationSize.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.CountStatisticgetActivationCount()
Returns the total number of sessions activated from the store

	synchronized (activationCountLock) {
	    activationCount.setCount(activationCountVal);
	   return (CountStatistic) activationCount.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.CountStatisticgetActivationErrorCount()
Returns the total number of sessions that couldn't be Activated from the store

	synchronized (activationCountLock) {
	    activationErrorCount.setCount(activationErrorCountVal);
	    return (CountStatistic) activationErrorCount.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.CountStatisticgetActivationSuccessCount()
Returns the total number of sessions successfully Activated from the store

	synchronized (activationCountLock) {
	    activationSuccessCount.setCount(activationSuccessCountVal);
	    return (CountStatistic) activationSuccessCount.unmodifiableView();
	}
    
public com.sun.enterprise.admin.monitor.stats.AverageRangeStatisticgetActivationTime()
Returns the time spent on activating beans from the store including total, min, max

	synchronized (activationTimeLock) {
	    return (AverageRangeStatistic) activationTime.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.RangeStatisticgetCurrentSize()
Returns the number of passivated / checkpointed sessions in the store

	synchronized (currentSizeLock) {
	    currentSize.setCount(provider.getCurrentStoreSize());
	    return (RangeStatistic) currentSize.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.CountStatisticgetExpiredSessionCount()
Returns the total number of expired sessions that were removed by this store

	synchronized (expiredSessionCountLock) {
	    expiredSessionCount.setCount(expiredSessionCountVal);
	    return (CountStatistic) expiredSessionCount.unmodifiableView();

	}
    
intgetNumExpiredSessionCount()

	synchronized (expiredSessionCountLock) {
	    return (int) expiredSessionCountVal;
	}
    
intgetNumPassivationCount()

	synchronized (passivationCountLock) {
	    return (int) passivationCountVal;
	}
    
intgetNumPassivationErrorCount()

	synchronized (passivationCountLock) {
	    return (int) passivationErrorCountVal;
	}
    
intgetNumPassivationSuccessCount()

	synchronized (passivationCountLock) {
	    return (int) passivationSuccessCountVal;
	}
    
public com.sun.enterprise.admin.monitor.stats.AverageRangeStatisticgetPassivatedBeanSize()
Returns the total number of bytes passivated by this store including total, min, maximum

	synchronized (passivationSizeLock) {
	    return (AverageRangeStatistic) passivationSize.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.CountStatisticgetPassivationCount()
Returns the total number of sessions passivated using this store

	synchronized (passivationCountLock) {
	    passivationCount.setCount(passivationCountVal);
	    return (CountStatistic) passivationSuccessCount.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.CountStatisticgetPassivationErrorCount()
Returns the total number of sessions that couldn't be Passivated using the store

	synchronized (passivationCountLock) {
	    passivationErrorCount.setCount(passivationErrorCountVal);
	    return (CountStatistic) passivationSuccessCount.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.CountStatisticgetPassivationSuccessCount()
Returns the total number of sessions successfully Passivated using the store

	synchronized (passivationCountLock) {
	    passivationSuccessCount.setCount(passivationSuccessCountVal);
	    return (CountStatistic) passivationSuccessCount.unmodifiableView();
	}
    
public com.sun.enterprise.admin.monitor.stats.AverageRangeStatisticgetPassivationTime()
Returns the time spent on passivating beans to the store including total, min, max

	synchronized (passivationTimeLock) {
	    return (AverageRangeStatistic) passivationTime.unmodifiableView();
	}
    
voidincrementActivationCount(boolean success)

	synchronized (activationCountLock) {
	    activationCountVal++;
	    if (success) {
		activationSuccessCountVal++;
	    } else {
		activationErrorCountVal++;
	    }
	}     
    
voidincrementExpiredSessionCountVal(long val)

	synchronized (expiredSessionCountLock) {
	    expiredSessionCountVal += val;
	}
    
voidincrementPassivationCount(boolean success)

	synchronized (passivationCountLock) {
	    passivationCountVal++;
	    if (success) {
		passivationSuccessCountVal++;
	    } else {
		passivationErrorCountVal++;
	    }
	}
    
protected voidinitialize()


	long now = System.currentTimeMillis();

	synchronized (currentSizeLock) {
	    currentSize = new MutableBoundedRangeStatisticImpl(
	    	new BoundedRangeStatisticImpl(0, 0, Long.MAX_VALUE,
			Long.MAX_VALUE, 0, "CurrentSize",
			"bytes", "Number of sessions in store", now, now)
	    );
	}

	synchronized (activationCountLock) {
	    activationCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("ActivationCount"));
	    activationSuccessCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("ActivationSuccessCount"));
	    activationErrorCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("ActivationErrorCount"));
	}

	synchronized (activationSizeLock) {
	    activationSize = new MutableAverageRangeStatisticImpl(
	    	new BoundedRangeStatisticImpl(0, 0, Long.MAX_VALUE,
			Long.MAX_VALUE, 0, "ActivationSize",
			"bytes", "Number of bytes activated", now, now)
	    );
	}

	synchronized (passivationSizeLock) {
	    passivationSize = new MutableAverageRangeStatisticImpl(
	    	new BoundedRangeStatisticImpl(0, 0, Long.MAX_VALUE,
			Long.MAX_VALUE, 0, "PassivationSize",
			"bytes", "Number of bytes passivated", now, now)
	    );
	}

	synchronized (passivationCountLock) {
	    passivationCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("PassivationCount"));
	    passivationSuccessCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("PassivationSuccessCount"));
	    passivationErrorCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("PassivationErrorCount"));
	}

	synchronized (expiredSessionCountLock) {
	    expiredSessionCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("ExpiredSessionCount"));
	}

	synchronized (activationTimeLock) {
	    activationTime = new MutableAverageRangeStatisticImpl(
	    	new BoundedRangeStatisticImpl(0, 0, Long.MAX_VALUE,
			Long.MAX_VALUE, 0, "ActivationTime",
			"millis", "Time spent on activation", now, now)
	    );
	}

	synchronized (passivationTimeLock) {
	    passivationTime = new MutableAverageRangeStatisticImpl(
	    	new BoundedRangeStatisticImpl(0, 0, Long.MAX_VALUE,
			Long.MAX_VALUE, 0, "PassivationTime",
			"millis", "Time spent on passivation", now, now)
	    );
	}
    
voidsetActivationSize(long val)

	synchronized (activationSizeLock) {
	    activationSize.setCount(val);
	}
    
voidsetActivationTime(long val)

	synchronized (activationTimeLock) {
	    activationTime.setCount(val);
	}
    
voidsetPassivationSize(long val)

	synchronized (passivationSizeLock) {
	    passivationSize.setCount(val);
	}
    
voidsetPassivationTime(long val)

	synchronized (passivationTimeLock) {
	    passivationTime.setCount(val);
	}