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

HAStatefulSessionStoreStatsImpl

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

Fields Summary
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
checkpointCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
checkpointSuccessCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl
checkpointErrorCount
private com.sun.enterprise.admin.monitor.stats.MutableAverageRangeStatisticImpl
checkpointSize
private com.sun.enterprise.admin.monitor.stats.MutableAverageRangeStatisticImpl
checkpointTime
private Object
checkpointCountLock
private Object
checkpointSizeLock
private Object
checkpointTimeLock
private long
checkpointCountVal
private long
checkpointSuccessCountVal
private long
checkpointErrorCountVal
Constructors Summary
public HAStatefulSessionStoreStatsImpl(com.sun.ejb.spi.stats.MonitorableSFSBStoreManager provider)


     
	 
    
	super(provider, "com.sun.enterprise.admin.monitor.stats.HAStatefulSessionStoreStats");
	initialize();
    
Methods Summary
protected voidappendStats(java.lang.StringBuffer sbuf)

	super.appendStats(sbuf);
	sbuf.append("CheckpointCount: ").append(checkpointCountVal)
	    .append("; ")
	    .append("CheckpointSuccessCount: ").append(checkpointSuccessCountVal)
	    .append("; ")
	    .append("CheckpointErrorCount: ").append(checkpointErrorCountVal)
	    .append("; ");

	appendTimeStatistic(sbuf, "CheckpointTime", checkpointTime);
    
public javax.management.j2ee.statistics.CountStatisticgetCheckpointCount()
Returns the total number of sessions checkpointed into the store

	synchronized (checkpointCountLock) {
	    checkpointCount.setCount(checkpointCountVal);
	   return (CountStatistic) checkpointCount.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.CountStatisticgetCheckpointErrorCount()
Returns the total number of sessions that couldn't be Checkpointed into the store

	synchronized (checkpointCountLock) {
	    checkpointErrorCount.setCount(checkpointErrorCountVal);
	    return (CountStatistic) checkpointErrorCount.unmodifiableView();
	}
    
public javax.management.j2ee.statistics.CountStatisticgetCheckpointSuccessCount()
Returns the total number of sessions successfully Checkpointed into the store

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

	synchronized (checkpointTimeLock) {
	    return (AverageRangeStatistic) checkpointTime.unmodifiableView();
	}
    
public com.sun.enterprise.admin.monitor.stats.AverageRangeStatisticgetCheckpointedBeanSize()
Returns the number of bytes checkpointed

	synchronized (checkpointTimeLock) {
	    return (AverageRangeStatistic) checkpointSize.unmodifiableView();
	}
    
public voidincrementCheckpointCount(boolean success)

	synchronized (checkpointCountLock) {
	    checkpointCountVal++;
	    if (success) {
		checkpointSuccessCountVal++;
	    } else {
		checkpointErrorCountVal++;
	    }
	}     
    
protected voidinitialize()

	super.initialize();

	synchronized (checkpointCountLock) {
	    checkpointCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("CheckpointCount"));
	    checkpointSuccessCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("CheckpointSuccessCount"));
	    checkpointErrorCount = new MutableCountStatisticImpl(
		new CountStatisticImpl("CheckpointErrorCount"));
	}

	long now = System.currentTimeMillis();
	synchronized (checkpointTimeLock) {
	    checkpointTime = new MutableAverageRangeStatisticImpl(
	    	new BoundedRangeStatisticImpl(0, 0, 0,
                                     0, 0, "CheckpointTime",
                                     "millis", "Time spent on checkpointing", 0, 0)
	    );
	}

	synchronized (checkpointSizeLock) {
	    checkpointSize = new MutableAverageRangeStatisticImpl(
	    	new BoundedRangeStatisticImpl(0, 0, 0,
                                     0, 0, "CheckpointSize",
                                     "millis", "Number of bytes checkpointed", 0, 0)
	    );
	}
    
public voidsetCheckpointSize(long val)

	synchronized (checkpointSizeLock) {
	    checkpointSize.setCount(val);
	}
    
public voidsetCheckpointTime(long val)

	synchronized (checkpointTimeLock) {
	    checkpointTime.setCount(val);
	}