1 23 24 29 package com.sun.enterprise.management.monitor; 30 31 import java.util.Set ; 32 import java.util.Iterator ; 33 34 import javax.management.j2ee.statistics.CountStatistic ; 35 import javax.management.j2ee.statistics.RangeStatistic ; 36 37 import com.sun.appserv.management.base.QueryMgr; 38 import com.sun.appserv.management.monitor.statistics.ConnectionPoolStats; 39 import com.sun.appserv.management.monitor.MonitoringStats; 40 41 42 import com.sun.enterprise.management.AMXTestBase; 43 import com.sun.enterprise.management.Capabilities; 44 45 46 abstract class ConnectionPoolStatsTest extends AMXMonitorTestBase 47 { 48 public 49 ConnectionPoolStatsTest() 50 { 51 } 52 53 54 protected abstract void nextMonitor( final MonitoringStats ms); 55 56 protected int 57 iterateAllMonitors( final String j2eeType ) 58 { 59 final Set monitors = getQueryMgr().queryJ2EETypeSet( j2eeType ); 60 final Iterator iter = monitors.iterator(); 61 62 int numMonitors = 0; 63 while ( iter.hasNext() ) 64 { 65 final MonitoringStats ms = (MonitoringStats)iter.next(); 66 ++numMonitors; 67 nextMonitor( ms ); 68 } 69 70 return numMonitors; 71 } 72 73 76 protected void 77 accessAllStatistics( final ConnectionPoolStats s ) 78 { 79 final RangeStatistic r1 = s.getNumConnUsed(); 80 assert( r1 != null ); 81 82 final RangeStatistic r2 = s.getNumConnFree() ; 83 assert( r2 != null ); 84 85 final RangeStatistic r3 = s.getConnRequestWaitTime(); 86 assert( r3 != null ); 87 88 final CountStatistic c1 = s.getNumConnFailedValidation() ; 89 assert( c1 != null ); 90 91 final CountStatistic c2 = s.getNumConnTimedOut(); 92 assert( c2 != null ); 93 94 final CountStatistic c3 = s.getWaitQueueLength(); 95 assert( c3 != null ); 96 97 final CountStatistic c4 = s.getNumConnCreated(); 98 assert( c4 != null ); 99 100 final CountStatistic c5 = s.getNumConnDestroyed(); 101 assert( c5 != null ); 102 103 106 109 final CountStatistic c8 = s.getAverageConnWaitTime(); 110 assert( c8 != null ); 111 } 112 113 } 114 115 116 117 118 119 120 | Popular Tags |