1 22 package org.jboss.resource.statistic.pool; 23 24 import java.util.ArrayList ; 25 import java.util.Collection ; 26 import java.util.Collections ; 27 import java.util.Iterator ; 28 import java.util.List ; 29 30 import org.jboss.resource.statistic.JBossStatistics; 31 32 38 public class JBossManagedConnectionPoolStatistics implements ManagedConnectionPoolStatistics 39 { 40 41 42 private static final long serialVersionUID = -2962342009092796221L; 43 44 private String poolName; 45 46 private long blockingTimeout; 47 private long idleTimeout; 48 private int min; 49 private int max; 50 private String criteria; 51 private boolean noTxnSeperatePool; 52 53 private final List subPools; 54 55 private boolean trackByTxn; 56 57 private boolean prefill; 58 59 public JBossManagedConnectionPoolStatistics(){ 60 61 subPools = new ArrayList (); 62 } 63 64 public JBossManagedConnectionPoolStatistics(int subPoolSize){ 65 66 subPools = new ArrayList (subPoolSize); 67 } 68 69 public JBossManagedConnectionPoolStatistics(String poolName){ 70 71 this(); 72 this.poolName = poolName; 73 74 } 75 76 public void addSubPool(final JBossSubPoolStatistics subPool){ 77 78 subPools.add(subPool); 79 } 80 81 public Collection getSubPools(){ 82 83 return Collections.unmodifiableCollection(subPools); 84 85 } 86 87 public long getBlockingTimeout() 88 { 89 90 return blockingTimeout; 91 92 } 93 94 public void setBlockingTimeout(long blockTime){ 95 96 this.blockingTimeout = blockTime; 97 98 } 99 100 public String getCriteria() 101 { 102 return this.criteria; 103 } 104 105 106 public long getIdleTimeout() 107 { 108 return this.idleTimeout; 109 } 110 111 public void setIdleTimeout(long idleTimeout){ 112 113 this.idleTimeout = idleTimeout; 114 115 } 116 public int getMax() 117 { 118 return this.max; 119 } 120 121 public void setMax(int max) 122 { 123 this.max = max; 124 } 125 public int getMin() 126 { 127 return this.min; 128 } 129 130 public void setMin(int min) 131 { 132 this.min = min; 133 134 } 135 136 public boolean getNoTxnSeperatePool() 137 { 138 return this.noTxnSeperatePool; 139 } 140 141 public void setNoTxnSeperatePool(boolean noTxnSeperatePool) 142 { 143 this.noTxnSeperatePool = noTxnSeperatePool; 144 } 145 146 public JBossManagedConnectionPoolStatistics getStatistics() 147 { 148 149 return null; 150 } 151 152 public int getSubPoolCount() 153 { 154 return subPools.size(); 155 156 } 157 158 public int getTotalConnectionsInUseCount() 159 { 160 int statValue = 0; 161 162 for(Iterator iter = subPools.iterator(); iter.hasNext();){ 163 164 JBossSubPoolStatistics statGroup = (JBossSubPoolStatistics)iter.next(); 165 statValue += statGroup.getConnectionsInUse(); 166 167 } 168 169 return statValue; 170 171 } 172 173 public int getTotalMaxConnectionsInUseCount() 174 { 175 176 int statValue = 0; 177 178 for(Iterator iter = subPools.iterator(); iter.hasNext();){ 179 180 JBossSubPoolStatistics statGroup = (JBossSubPoolStatistics)iter.next(); 181 statValue += statGroup.getMaxConnectionsInUse(); 182 183 } 184 185 return statValue; 186 187 } 188 189 public boolean getTrackByTxn() 190 { 191 return this.trackByTxn; 192 } 193 194 public void setTrackByTxn(boolean trackByTxn) 195 { 196 this.trackByTxn = trackByTxn; 197 198 } 199 200 public boolean getPrefill() 201 { 202 return prefill; 204 } 205 206 public void setPrefill(boolean prefill) 207 { 208 this.prefill = prefill; 209 } 210 211 public String getName() 212 { 213 return this.poolName; 214 } 215 216 public void setName(String name) 217 { 218 this.poolName = name; 219 } 220 221 public void setCriteria(String criteria) 222 { 223 this.criteria = criteria; 224 225 } 226 227 public void addSubPool(JBossStatistics subPool) 228 { 229 231 } 232 233 } 234 | Popular Tags |