1 22 package org.jboss.management.j2ee.statistics; 23 24 import javax.management.j2ee.statistics.BoundedRangeStatistic ; 25 import javax.management.j2ee.statistics.CountStatistic ; 26 import javax.management.j2ee.statistics.JCAConnectionPoolStats ; 27 import javax.management.j2ee.statistics.RangeStatistic ; 28 import javax.management.j2ee.statistics.TimeStatistic ; 29 30 36 public class JCAConnectionPoolStatsImpl extends JCAConnectionStatsImpl 37 implements JCAConnectionPoolStats 38 { 39 41 42 private static final long serialVersionUID = 6867747857618271195L; 43 44 46 public JCAConnectionPoolStatsImpl(String cfName, String mcfName, 47 BoundedRangeStatistic freePoolSize, BoundedRangeStatistic poolSize) 48 { 49 this(cfName, mcfName, null, null, null, null, freePoolSize, poolSize, null); 50 } 51 52 public JCAConnectionPoolStatsImpl(String cfName, String mcfName, 53 TimeStatistic waitTime, TimeStatistic useTime, CountStatistic closeCount, 54 CountStatistic createCount, BoundedRangeStatistic freePoolSize, 55 BoundedRangeStatistic poolSize, RangeStatistic waitingThreadCount) 56 { 57 super(cfName, mcfName, waitTime, useTime); 58 if (closeCount == null) 59 { 60 closeCount = new CountStatisticImpl("CloseCount", "1", 61 "The number of connection closes"); 62 } 63 if (createCount == null) 64 { 65 createCount = new CountStatisticImpl("CreateCount", "1", 66 "The number of connection creates"); 67 } 68 if (waitingThreadCount == null) 69 { 70 waitingThreadCount = new RangeStatisticImpl("WaitingThreadCount", 71 "1", "The number of threads waiting for a connection"); 72 } 73 super.addStatistic("CloseCount", closeCount); 74 super.addStatistic("CreateCount", createCount); 75 super.addStatistic("FreePoolSize", freePoolSize); 76 super.addStatistic("PoolSize", poolSize); 77 super.addStatistic("WaitingThreadCount", waitingThreadCount); 78 } 79 80 public CountStatistic getCloseCount() 81 { 82 CountStatistic cs = (CountStatistic ) getStatistic("CloseCount"); 83 return cs; 84 } 85 86 public CountStatistic getCreateCount() 87 { 88 CountStatistic cs = (CountStatistic ) getStatistic("CreateCount"); 89 return cs; 90 } 91 92 public BoundedRangeStatistic getFreePoolSize() 93 { 94 BoundedRangeStatistic brs = (BoundedRangeStatistic ) getStatistic("FreePoolSize"); 95 return brs; 96 } 97 98 public BoundedRangeStatistic getPoolSize() 99 { 100 BoundedRangeStatistic brs = (BoundedRangeStatistic ) getStatistic("PoolSize"); 101 return brs; 102 } 103 104 public RangeStatistic getWaitingThreadCount() 105 { 106 RangeStatistic rs = (RangeStatistic ) getStatistic("WaitingThreadCount"); 107 return rs; 108 } 109 } 110 | Popular Tags |