FileDocCategorySizeDatePackage
ConnectorWorkMgmtStatsImpl.javaAPI DocGlassfish v2 API7537Fri May 04 22:34:26 BST 2007com.sun.enterprise.connectors.work.monitor

ConnectorWorkMgmtStatsImpl

public final class ConnectorWorkMgmtStatsImpl extends com.sun.enterprise.resource.monitor.AbstractStatsImpl implements com.sun.enterprise.admin.monitor.stats.ConnectorWorkMgmtStats
This class provides an implementation of the JDBCConnectionPoolStats interface. The implementations of the interface methods primarily delegate the task of statistic gathering to the work-manager of the inbound resource adapter
author
Sivakumar Thyagarajan

Fields Summary
private static final Logger
_logger
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
gsImpl
private javax.management.j2ee.statistics.RangeStatistic
activeWorkCount
private javax.management.j2ee.statistics.RangeStatistic
waitQueueLength
private javax.management.j2ee.statistics.RangeStatistic
workRequestWaitTime
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
submittedWorkCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
rejectedWorkCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
completedWorkCount
private MonitorableWorkManager
workManager
Constructors Summary
public ConnectorWorkMgmtStatsImpl(com.sun.enterprise.connectors.ActiveInboundResourceAdapter inboundRA)

    
         
        this.workManager = (MonitorableWorkManager)inboundRA.
                                    getBootStrapContext().getWorkManager();
        initializeStatistics();
        try {
            gsImpl = new GenericStatsImpl(
            this.getClass().getInterfaces()[0].getName(), this );
            } catch( ClassNotFoundException cnfe ) {
            //@todo:add to reosurces file
                _logger.log( Level.INFO, "workmgmtmon.cnfe", "GenericStatsImpl" );
            }
    
Methods Summary
public javax.management.j2ee.statistics.RangeStatisticgetActiveWorkCount()

        activeWorkCount = getUpdatedRangeStatistic(activeWorkCount, 
                        workManager.getCurrentActiveWorkCount(), 
                        workManager.getMaxActiveWorkCount(), 
                        workManager.getMinActiveWorkCount());
        return activeWorkCount;
    
public javax.management.j2ee.statistics.CountStatisticgetCompletedWorkCount()

        completedWorkCount.setCount( workManager.getCompletedWorkCount());
        return (CountStatistic) completedWorkCount.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetRejectedWorkCount()

        rejectedWorkCount.setCount( workManager.getRejectedWorkCount());
        return (CountStatistic) rejectedWorkCount.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetSubmittedWorkCount()

        submittedWorkCount.setCount( workManager.getSubmittedWorkCount());
        return (CountStatistic) submittedWorkCount.unmodifiableView();
    
public javax.management.j2ee.statistics.RangeStatisticgetWaitQueueLength()

        waitQueueLength = getUpdatedRangeStatistic(waitQueueLength, 
                        workManager.getWaitQueueLength(), 
                        workManager.getMaxWaitQueueLength(),
                        workManager.getMinWaitQueueLength());
        return waitQueueLength;
    
public javax.management.j2ee.statistics.RangeStatisticgetWorkRequestWaitTime()

        workRequestWaitTime = getUpdatedRangeStatistic(workRequestWaitTime, 0, 
                        workManager.getMaxWorkRequestWaitTime(),
                        workManager.getMinWorkRequestWaitTime());
        return workRequestWaitTime;
    
private voidinitializeStatistics()

        long time = System.currentTimeMillis();
        CountStatistic cs = null;
    
        cs = new CountStatisticImpl(0,
            "SubmittedWorkCount", "", 
        "Number of work objects submitted by a connector module for  execution"
        + "WorkQueue before executing",time, time);
        submittedWorkCount = new MutableCountStatisticImpl( cs );

        cs = new CountStatisticImpl(0,
            "RejectedWorkCount", "", 
        "Number of work objects rejected by the application server",time, time);
        rejectedWorkCount = new MutableCountStatisticImpl( cs );

        cs = new CountStatisticImpl(0,
            "CompletedWorkCount", "", 
        "Number of work objects completed execution",time, time);
        completedWorkCount = new MutableCountStatisticImpl( cs );

        //the low water mark is set with a seed value of 1 to 
        //ensure that the comparison with currentVal returns 
        //the correct low water mark the first time around
        //the least number of connections that we can use is always 1
        activeWorkCount = new RangeStatisticImpl(0, 0, 
            1, "ActiveWorkCount", "",
        "Number of active work objects",
        time, time);

        waitQueueLength = new RangeStatisticImpl(0, 0, 
            1, "WaitQueueLength", "",
        "Number of work objects waiting in the queue for execution",
        time, time);

        workRequestWaitTime = new RangeStatisticImpl(0, 0, 
                        1, "workRequestWaitTime", "",
                    "Number of work objects waiting in the queue for execution",
                    time, time);