1 25 26 package org.objectweb.jonas.resource; 27 28 import java.util.Properties ; 30 31 import org.objectweb.jonas.resource.pool.api.Pool; 32 import org.objectweb.jonas.resource.ConnectionManagerImpl; 33 import org.objectweb.jonas.management.ReconfiguredProp; 34 import org.objectweb.jonas.management.j2eemanagement.J2EEManagedObject; 35 36 42 public class JCAConnectionFactory extends J2EEManagedObject { 43 44 48 private String managedConnectionFactory = null; 49 50 54 private String description = null; 55 58 private String jndiname = null; 59 62 private Properties prop = null; 63 64 67 private ConnectionManagerImpl cm = null; 68 69 72 private Pool pool = null; 73 74 77 private long sequenceNumber = 0; 78 79 86 public JCAConnectionFactory(String objectName, String jndiname, Properties prop, 87 String description, ConnectionManagerImpl cm) { 88 super(objectName); 89 this.jndiname = jndiname; 90 this.prop = prop; 91 this.description = description; 92 this.cm = cm; 93 this.pool = cm.getPool(); 94 } 95 96 100 public String getDescription() { 101 return description; 102 } 103 104 108 public String getJndiName() { 109 return jndiname; 110 } 111 112 116 public String getManagedConnectionFactory() { 117 return managedConnectionFactory; 118 } 119 120 124 public Properties getProperties() { 125 return prop; 126 } 127 128 133 public void setManagedConnectionFactory(String managedConnectionFactoryObjectName) { 134 managedConnectionFactory = managedConnectionFactoryObjectName; 135 } 136 137 139 142 public Integer getJdbcConnCheckLevel() { 143 return new Integer (cm.getCheckLevel()); 144 } 145 149 public void setJdbcConnCheckLevel(Integer level) { 150 cm.setCheckLevel(level.intValue()); 151 } 152 153 156 public Integer getConnMaxAge() { 157 return new Integer (pool.getMaxAge()); 158 } 159 162 public void setConnMaxAge(Integer mn) { 163 pool.setMaxAge(mn.intValue()); 164 } 165 166 169 public Integer getMaxSize() { 170 return new Integer (pool.getMaxSize()); 171 } 172 175 public void setMaxSize(Integer max) { 176 try { 177 pool.setMaxSize(max.intValue()); 178 } catch(Exception ex) { } 179 } 180 181 184 public Integer getMaxOpentime() { 185 return new Integer (pool.getMaxOpentime()); 186 } 187 190 public void setMaxOpentime(Integer mn) { 191 pool.setMaxOpentime(mn.intValue()); 192 } 193 194 197 public Integer getMaxWaiters() { 198 return new Integer (pool.getMaxWaiters()); 199 } 200 203 public void setMaxWaiters(Integer max) { 204 pool.setMaxWaiters(max.intValue()); 205 } 206 207 210 public Integer getMaxWaitTime() { 211 return new Integer (pool.getMaxWaitTime()); 212 } 213 214 217 public void setMaxWaitTime(Integer max) { 218 pool.setMaxWaitTime(max.intValue()); 219 } 220 221 224 public Integer getMinSize() { 225 return new Integer (pool.getMinSize()); 226 } 227 231 public void setMinSize(Integer min) { 232 try { 233 pool.setMinSize(min.intValue()); 234 } catch (Exception ex) { } 235 } 236 237 240 public Integer getSamplingPeriod() { 241 return new Integer (pool.getSamplingPeriod()); 242 } 243 244 247 public void setSamplingPeriod(Integer i) { 248 pool.setSamplingPeriod(i.intValue()); 249 } 250 251 254 public String getJdbcTestStatement() { 255 return cm.getTestStatement(); 256 } 257 260 public void setJdbcTestStatement(String test) { 261 cm.setTestStatement(test); 262 } 263 264 266 269 public Integer getConnectionFailures() { 270 return new Integer (pool.getConnectionFailures()); 271 } 272 275 public Integer getConnectionLeaks() { 276 return new Integer (pool.getConnectionLeaks()); 277 } 278 281 public Integer getCurrentBusy() { 282 return new Integer (pool.getCurrentBusy()); 283 } 284 287 public Integer getBusyMax() { 288 return new Integer (pool.getBusyMaxRecent()); 289 } 290 293 public Integer getBusyMin() { 294 return new Integer (pool.getBusyMinRecent()); 295 } 296 299 public Integer getCurrentInTx() { 300 return new Integer (cm.getCurrentInTx()); 301 } 302 305 public Integer getCurrentOpened() { 306 return new Integer (pool.getCurrentOpened()); 307 } 308 311 public Integer getCurrentWaiters() { 312 return new Integer (pool.getCurrentWaiters()); 313 } 314 317 public Integer getOpenedCount() { 318 return new Integer (pool.getOpenedCount()); 319 } 320 323 public Integer getRejectedFull() { 324 return new Integer (pool.getRejectedFull()); 325 } 326 329 public Integer getRejectedOpen() { 330 return new Integer (pool.getRejectedOpen()); 331 } 332 335 public Integer getRejectedOther() { 336 return new Integer (pool.getRejectedOther()); 337 } 338 341 public Integer getRejectedTimeout() { 342 return new Integer (pool.getRejectedTimeout()); 343 } 344 347 public Integer getServedOpen() { 348 return new Integer (pool.getServedOpen()); 349 } 350 353 public Integer getWaiterCount() { 354 return new Integer (pool.getWaiterCount()); 355 } 356 359 public Integer getWaitersHigh() { 360 return new Integer (pool.getWaitersHigh()); 361 } 362 365 public Integer getWaitersHighRecent() { 366 return new Integer (pool.getWaitersHighRecent()); 367 } 368 371 public Long getWaitingHigh() { 372 return new Long (pool.getWaitingHigh()); 373 } 374 377 public Long getWaitingHighRecent() { 378 return new Long (pool.getWaitingHighRecent()); 379 } 380 383 public Long getWaitingTime() { 384 return new Long (pool.getWaitingTime()); 385 } 386 387 391 protected long getSequenceNumber() { 392 return ++sequenceNumber; 393 } 394 395 } 396 | Popular Tags |