FileDocCategorySizeDatePackage
ConnectionPoolStatsImpl.javaAPI DocGlassfish v2 API14796Fri May 04 22:35:18 BST 2007com.sun.enterprise.resource.monitor

ConnectionPoolStatsImpl

public abstract class ConnectionPoolStatsImpl extends AbstractStatsImpl implements com.sun.enterprise.admin.monitor.stats.JDBCConnectionPoolStats, com.sun.enterprise.admin.monitor.stats.ConnectorConnectionPoolStats
An abstract class that provides an implementation of the ConnectionPoolStats interface. This common implementation is used by the JDBCConnectionPoolStats and ConnectorConnectionPoolStats implementations.
author
Sivakumar Thyagarajan

Fields Summary
protected com.sun.enterprise.resource.MonitorableResourcePool
pool_
private static com.sun.enterprise.util.i18n.StringManager
localStrings
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
numConnFailedValidation_
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
numConnTimedOut_
private javax.management.j2ee.statistics.RangeStatistic
numConnUsed_
private javax.management.j2ee.statistics.RangeStatistic
numConnFree_
private javax.management.j2ee.statistics.RangeStatistic
numConnRequestWaitTime_
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
averageConnWaitTime
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
waitQueueLength
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
numConnCreated
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
numConnDestroyed
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
numConnAcquired
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
numConnReleased
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
numConnMatched
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
numConnNotMatched
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
numPotentialConnLeak
protected static final Logger
_logger
Constructors Summary
Methods Summary
public javax.management.j2ee.statistics.CountStatisticgetAverageConnWaitTime()

       //Time taken by all connection requests divided by total number of 
       //connections acquired in the sampling period.
       long averageWaitTime = 0;
       if (getNumConnAcquired().getCount() != 0) {
           averageWaitTime = pool_.getTotalConnectionRequestWaitTime() / 
                                 (getNumConnAcquired().getCount());
       } else {
           averageWaitTime = 0;
       }

       averageConnWaitTime.setCount(averageWaitTime);
       return (CountStatistic)averageConnWaitTime.unmodifiableView();
   
public javax.management.j2ee.statistics.RangeStatisticgetConnRequestWaitTime()

       numConnRequestWaitTime_ = getUpdatedRangeStatistic(
               numConnRequestWaitTime_ , pool_.getCurrentConnRequestWaitTime() , 
               pool_.getMaxConnRequestWaitTime(), 
               pool_.getMinConnRequestWaitTime());
       return numConnRequestWaitTime_;
   
private java.lang.StringgetLocalizedStringFor(java.lang.String key, java.lang.String defaultValue)

 
       return localStrings.getStringWithDefault(key , defaultValue);
   
public javax.management.j2ee.statistics.CountStatisticgetNumConnAcquired()

       numConnAcquired.setCount(pool_.getNumConnAcquired());
       return (CountStatistic)numConnAcquired.unmodifiableView();
   
public javax.management.j2ee.statistics.CountStatisticgetNumConnCreated()

       numConnCreated.setCount(pool_.getNumConnCreated());
       return (CountStatistic)numConnCreated.unmodifiableView();
   
public javax.management.j2ee.statistics.CountStatisticgetNumConnDestroyed()

       numConnDestroyed.setCount(pool_.getNumConnDestroyed());
       return (CountStatistic)numConnDestroyed.unmodifiableView();
   
public javax.management.j2ee.statistics.CountStatisticgetNumConnFailedValidation()

    
       
        numConnFailedValidation_.setCount( 
            pool_.getNumConnFailedValidation() );
        return (CountStatistic)numConnFailedValidation_.unmodifiableView();
    
public javax.management.j2ee.statistics.RangeStatisticgetNumConnFree()

       numConnFree_ = getUpdatedRangeStatistic(numConnFree_, 
                       pool_.getNumConnFree(), pool_.getMaxNumConnFree(), 
                       pool_.getMinNumConnFree()); 
       return numConnFree_;
   
public javax.management.j2ee.statistics.CountStatisticgetNumConnNotSuccessfullyMatched()

	   numConnNotMatched.setCount(pool_.getNumConnNotSuccessfullyMatched());
   	   return (CountStatistic)numConnNotMatched.unmodifiableView();
   
public javax.management.j2ee.statistics.CountStatisticgetNumConnReleased()

       numConnReleased.setCount(pool_.getNumConnReleased());
       return (CountStatistic)numConnReleased.unmodifiableView();
   
public javax.management.j2ee.statistics.CountStatisticgetNumConnSuccessfullyMatched()

   	   numConnMatched.setCount(pool_.getNumConnSuccessfullyMatched());
   	   return (CountStatistic)numConnMatched.unmodifiableView();
   
public javax.management.j2ee.statistics.CountStatisticgetNumConnTimedOut()

        numConnTimedOut_.setCount( 
            pool_.getNumConnTimedOut() );
        return (CountStatistic) numConnTimedOut_.unmodifiableView();
    
public javax.management.j2ee.statistics.RangeStatisticgetNumConnUsed()

        numConnUsed_ = getUpdatedRangeStatistic(numConnUsed_, 
                        pool_.getNumConnInUse(), pool_.getMaxNumConnUsed(), 
                        pool_.getMinNumConnUsed()); 
        return numConnUsed_;
    
public javax.management.j2ee.statistics.CountStatisticgetNumPotentialConnLeak()

	   numPotentialConnLeak.setCount(pool_.getNumPotentialConnLeak());
   	   return (CountStatistic)numPotentialConnLeak.unmodifiableView();
   
public javax.management.j2ee.statistics.CountStatisticgetWaitQueueLength()

       waitQueueLength.setCount(pool_.getNumThreadWaiting());
       return (CountStatistic)waitQueueLength.unmodifiableView();
   
protected voidinitializeStatistics()


        long time = System.currentTimeMillis();
        CountStatistic cs = null;
    
        cs = new CountStatisticImpl(0,
            getLocalizedStringFor("num.conn.failed.validation", 
                            "NumConnFailedValidation"), 
            getLocalizedStringFor("stat.count", "Count"),
            getLocalizedStringFor("num.conn.failed.validation.desc", 
                            "Number Of Connections that failed validation"),
            time, time);
        numConnFailedValidation_ = new MutableCountStatisticImpl( cs );

        cs = new CountStatisticImpl(0,
            getLocalizedStringFor("num.conn.timedout", "NumConnTimedOut"), 
            getLocalizedStringFor("stat.count", "Count"),
            getLocalizedStringFor("num.conn.timedout.desc", 
                            "Number of Connection requests that timed out waiting"),
            time, time);
        numConnTimedOut_ = new MutableCountStatisticImpl( cs );

        cs = new CountStatisticImpl(0,
                        getLocalizedStringFor("num.conn.created","NumConnCreated"), 
                        getLocalizedStringFor("stat.count", "Count"),
                        getLocalizedStringFor("num.conn.created.desc",
                                        "Number of Connection that have been created"),
                        time, time);
        numConnCreated = new MutableCountStatisticImpl( cs );
        
        cs = new CountStatisticImpl(0,
                        getLocalizedStringFor("num.conn.destroyed", 
                                        "NumConnDestroyed"),
                        getLocalizedStringFor("stat.count", "Count"),
                        getLocalizedStringFor("num.conn.destroyed.desc", 
                                        "Number of Connection that have been destroyed") ,
                        time, time);
        numConnDestroyed = new MutableCountStatisticImpl( cs );
        
        cs = new CountStatisticImpl(0,
                        getLocalizedStringFor("num.conn.opened", "NumConnOpened"), 
                        getLocalizedStringFor("stat.count", "Count"),
                        getLocalizedStringFor("num.conn.opened.desc", 
                                        "Number of Connection that have been acquired"),
                    time, time);
        numConnAcquired = new MutableCountStatisticImpl( cs );
        
        cs = new CountStatisticImpl(0,
                        getLocalizedStringFor("num.conn.closed", "NumConnClosed"), 
                        getLocalizedStringFor("stat.count", "Count"),
                        getLocalizedStringFor("num.conn.closed.desc", 
                                        "Number of Connection that have been released"),
                    time, time);
        numConnReleased = new MutableCountStatisticImpl( cs );
        
        
        cs = new CountStatisticImpl(0,
                        getLocalizedStringFor("avg.conn.wait.time", 
                                        "AvgConnWaitTime"), 
                        getLocalizedStringFor("stat.milliseconds", "milliseconds"),
                        getLocalizedStringFor("avg.conn.wait.time.desc", 
                                        "Average wait time-duration per successful connection request"),
                        time, time);
        averageConnWaitTime = new MutableCountStatisticImpl( cs );
        
        cs = new CountStatisticImpl(0,
                        getLocalizedStringFor("wait.queue.length", 
                                        "WaitQueueLength"),
                        getLocalizedStringFor("stat.count", "Count"),
                        getLocalizedStringFor("wait.queue.length.desc", 
                                        "Connection request Wait Queue length"),
                        time, time);
        waitQueueLength = 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
        numConnUsed_ = new RangeStatisticImpl(0, 0, 1, 
                        getLocalizedStringFor("num.conn.used", "NumConnUsed"), 
                        getLocalizedStringFor("stat.count", "Count"),
                        getLocalizedStringFor("num.conn.used.desc", 
                                        "Number Of Connections used"),
                        time, time);
        
        numConnFree_ = new RangeStatisticImpl(0, 0, 1, 
                        getLocalizedStringFor("num.conn.free", "NumConnFree"), 
                        getLocalizedStringFor("stat.count", "Count"),
                        getLocalizedStringFor("num.conn.free.desc", 
                                        "Number Of Free Connections"),
                        time, time);
        numConnRequestWaitTime_ = new RangeStatisticImpl(0, 0, 1, 
                        getLocalizedStringFor("conn.request.wait.time", 
                                        "ConnRequestWaitTime"), 
                        getLocalizedStringFor("stat.milliseconds", "milliseconds"),
                        getLocalizedStringFor("conn.request.wait.time.desc", 
                                        "Max and min connection request wait times"),
                         time, time);
        
        cs = new CountStatisticImpl(0, 
        		getLocalizedStringFor("num.conn.matched", "NumConnMatched"), 
                getLocalizedStringFor("stat.count", "Count"),
                getLocalizedStringFor("num.conn.matched.desc", 
                                "Number of Connection that were successfully matched by the MCF. "),
            time, time);
        numConnMatched = new MutableCountStatisticImpl( cs );

        cs = new CountStatisticImpl(0, 
        		getLocalizedStringFor("num.conn.not.matched", "NumConnNotMatched"), 
                getLocalizedStringFor("stat.count", "Count"),
                getLocalizedStringFor("num.conn.not.matched.desc", 
                                "Number of Connection that were rejected by the MCF. "),
            time, time);
        numConnNotMatched = new MutableCountStatisticImpl( cs );
        
        cs = new CountStatisticImpl(0, 
        		getLocalizedStringFor("num.potential.connection.leak", "NumPotentialConnLeak"), 
                getLocalizedStringFor("stat.count", "Count"),
                getLocalizedStringFor("num.potential.connection.leak.desc", 
                                "Number of potential connections leak detected."),
            time, time);
        numPotentialConnLeak = new MutableCountStatisticImpl( cs );