1 23 24 package com.sun.enterprise.connectors; 25 26 import com.sun.enterprise.util.Utility; 27 import com.sun.enterprise.repository.J2EEResourceBase; 28 import com.sun.enterprise.repository.J2EEResource; 29 import java.io.Serializable ; 30 import java.util.Iterator ; 31 import com.sun.enterprise.deployment.EnvironmentProperty; 32 import com.sun.enterprise.connectors.authentication.ConnectorSecurityMap; 33 34 43 44 public class ConnectorConnectionPool extends J2EEResourceBase 45 implements Serializable { 46 47 protected ConnectorDescriptorInfo connectorDescriptorInfo_ ; 48 49 protected String steadyPoolSize_; 50 protected String maxPoolSize_; 51 protected String maxWaitTimeInMillis_; 52 protected String poolResizeQuantity_; 53 protected String idleTimeoutInSeconds_; 54 protected boolean failAllConnections_; 55 protected boolean matchConnections_ = false; 59 60 protected int transactionSupport_; 61 protected boolean isConnectionValidationRequired_ = false; 62 63 private boolean lazyConnectionAssoc_ = false; 64 private boolean lazyConnectionEnlist_ = false; 65 private boolean associateWithThread_ = false; 66 private boolean nonTransactional_ = false; 67 private boolean nonComponent_ = false; 68 private boolean connectionLeakTracing_ = false; 69 private ConnectorSecurityMap[] securityMaps = null; 70 private boolean isAuthCredentialsDefinedInPool_ = false; 71 72 private boolean validateAtmostEveryIdleSecs = false; 75 76 77 80 81 public ConnectorConnectionPool(String name) { 82 super(name); 83 } 84 85 87 88 protected J2EEResource doClone(String name) { 89 90 ConnectorConnectionPool clone = new ConnectorConnectionPool(name); 91 ConnectorDescriptorInfo cdi = connectorDescriptorInfo_.doClone(); 92 clone.setSecurityMaps(this.securityMaps); 93 clone.setSteadyPoolSize(getSteadyPoolSize()); 94 clone.setMaxPoolSize(getMaxPoolSize()); 95 clone.setMaxWaitTimeInMillis(getMaxWaitTimeInMillis()); 96 clone.setPoolResizeQuantity(getPoolResizeQuantity()); 97 clone.setIdleTimeoutInSeconds(getIdleTimeoutInSeconds()); 98 clone.setFailAllConnections(isFailAllConnections()); 99 clone.setMatchConnections(matchConnections()); 100 clone.setTransactionSupport( getTransactionSupport()); 101 clone.setConnectorDescriptorInfo(cdi); 102 clone.setConnectionValidationRequired( isConnectionValidationRequired_ ); 103 clone.setLazyConnectionAssoc( isLazyConnectionAssoc() ); 104 clone.setAssociateWithThread( isAssociateWithThread() ); 105 clone.setNonComponent( isNonComponent() ); 106 clone.setNonTransactional( isNonTransactional() ); 107 clone.setConnectionLeakTracing( isConnectionLeakTracing() ); 108 109 return clone; 110 } 111 112 public void setAuthCredentialsDefinedInPool(boolean authCred) { 113 this.isAuthCredentialsDefinedInPool_ = authCred; 114 } 115 116 public boolean getAuthCredentialsDefinedInPool() { 117 return this.isAuthCredentialsDefinedInPool_; 118 } 119 120 126 127 public ConnectorDescriptorInfo getConnectorDescriptorInfo() { 128 return connectorDescriptorInfo_; 129 } 130 131 137 138 public void setConnectorDescriptorInfo( 139 ConnectorDescriptorInfo connectorDescriptorInfo) 140 { 141 connectorDescriptorInfo_ = connectorDescriptorInfo; 142 } 143 144 148 149 public int getType() { 150 return J2EEResource.JDBC_CONNECTION_POOL; 151 } 152 153 157 158 public String getSteadyPoolSize() { 159 return steadyPoolSize_; 160 } 161 162 166 167 public void setSteadyPoolSize(String steadyPoolSize) { 168 steadyPoolSize_ = steadyPoolSize; 169 } 170 171 175 176 public String getMaxPoolSize() { 177 return maxPoolSize_; 178 } 179 180 184 185 public void setMaxPoolSize(String maxPoolSize) { 186 maxPoolSize_ = maxPoolSize; 187 } 188 189 193 194 public String getMaxWaitTimeInMillis() { 195 return maxWaitTimeInMillis_; 196 } 197 198 202 203 public void setMaxWaitTimeInMillis(String maxWaitTimeInMillis) { 204 maxWaitTimeInMillis_ = maxWaitTimeInMillis; 205 } 206 207 211 212 public String getPoolResizeQuantity() { 213 return poolResizeQuantity_; 214 } 215 216 220 221 public void setPoolResizeQuantity(String poolResizeQuantity) { 222 poolResizeQuantity_ = poolResizeQuantity; 223 } 224 225 229 230 public String getIdleTimeoutInSeconds() { 231 return idleTimeoutInSeconds_; 232 } 233 234 238 239 public void setIdleTimeoutInSeconds(String idleTimeoutInSeconds) { 240 idleTimeoutInSeconds_ = idleTimeoutInSeconds; 241 } 242 243 247 248 public boolean isFailAllConnections() { 249 return failAllConnections_; 250 } 251 252 257 258 public void setFailAllConnections(boolean failAllConnections) { 259 failAllConnections_ = failAllConnections; 260 } 261 262 267 268 public boolean matchConnections() { 269 return matchConnections_; 270 } 271 272 277 278 public void setMatchConnections(boolean matchConnections) { 279 matchConnections_ = matchConnections; 280 } 281 282 292 public int getTransactionSupport() { 293 return transactionSupport_; 294 } 295 296 306 public void setTransactionSupport( int transactionSupport ) { 307 transactionSupport_ = transactionSupport; 308 } 309 310 313 public void setConnectionValidationRequired( boolean validation ) { 314 isConnectionValidationRequired_ = validation; 315 } 316 317 320 public boolean isIsConnectionValidationRequired() { 321 return isConnectionValidationRequired_; 322 } 323 324 public boolean isLazyConnectionAssoc() { 325 return lazyConnectionAssoc_; 326 } 327 328 public void setLazyConnectionAssoc( boolean match ) { 329 lazyConnectionAssoc_ = match; 330 } 331 332 public boolean isLazyConnectionEnlist() { 333 return lazyConnectionEnlist_; 334 } 335 336 public void setLazyConnectionEnlist( boolean flag ) { 337 lazyConnectionEnlist_ = flag; 338 } 339 340 public boolean isAssociateWithThread() { 341 return associateWithThread_; 342 } 343 344 public void setAssociateWithThread( boolean match ) { 345 associateWithThread_ = match; 346 } 347 348 public boolean isNonTransactional() { 349 return nonTransactional_; 350 } 351 352 public void setNonTransactional( boolean match ) { 353 nonTransactional_ = match; 354 } 355 356 public boolean isNonComponent() { 357 return nonComponent_; 358 } 359 360 public void setNonComponent( boolean match ) { 361 nonComponent_ = match; 362 } 363 public boolean isConnectionLeakTracing() { 364 return connectionLeakTracing_; 365 } 366 367 public void setConnectionLeakTracing( boolean match ) { 368 connectionLeakTracing_ = match; 369 } 370 371 372 375 376 public void setSecurityMaps(ConnectorSecurityMap[] securityMapArray){ 377 this.securityMaps = securityMapArray; 378 } 379 380 383 384 public ConnectorSecurityMap[] getSecurityMaps(){ 385 return this.securityMaps; 386 } 387 388 392 public String toString() { 393 String returnVal = null; 394 StringBuffer sb = new StringBuffer ("ConnectorConnectionPool :: "); 395 try { 396 sb.append(getName()); 397 sb.append("\nsteady size: "); 398 sb.append(getSteadyPoolSize()); 399 sb.append("\nmax pool size: "); 400 sb.append(getMaxPoolSize()); 401 sb.append("\nmax wait time: "); 402 sb.append(getMaxWaitTimeInMillis()); 403 sb.append("\npool resize qty: "); 404 sb.append(getPoolResizeQuantity()); 405 sb.append("\nIdle timeout: "); 406 sb.append(getIdleTimeoutInSeconds()); 407 sb.append("\nfailAllConnections: "); 408 sb.append(isFailAllConnections()); 409 sb.append("\nTransaction Support Level: "); 410 sb.append(transactionSupport_); 411 sb.append("\nmatchConnections_ "); 412 sb.append(matchConnections_); 413 sb.append("\nisConnectionValidationRequired_ "); 414 sb.append(isConnectionValidationRequired_); 415 sb.append("\nassociateWithThread_ "); 416 sb.append(associateWithThread_); 417 sb.append("\nlazyConnectionAssoc_ "); 418 sb.append(lazyConnectionAssoc_); 419 sb.append("\nnonTransactional_ "); 420 sb.append(nonTransactional_); 421 sb.append("\nnonComponent_ "); 422 sb.append(nonComponent_); 423 sb.append("\nconnectionLeakTracing_ "); 424 sb.append(connectionLeakTracing_); 425 sb.append("\nConnectorDescriptorInfo -> "); 426 sb.append("\nrarName: "); 427 sb.append(connectorDescriptorInfo_.getRarName()); 428 sb.append("\nresource adapter class: "); 429 sb.append(connectorDescriptorInfo_.getResourceAdapterClassName()); 430 sb.append("\nconnection def name: "); 431 sb.append(connectorDescriptorInfo_.getConnectionDefinitionName()); 432 sb.append("\nMCF Config properties-> "); 433 Iterator iter = 434 connectorDescriptorInfo_.getMCFConfigProperties().iterator(); 435 while( iter.hasNext() ) { 436 EnvironmentProperty ep = (EnvironmentProperty)iter.next(); 437 sb.append(ep.getName()); 438 sb.append(":"); 439 sb.append( ("password".equalsIgnoreCase(ep.getName()) ? "****" : ep.getValue() )); 440 sb.append("\n"); 441 } 442 if ( securityMaps != null ) { 443 sb.append("SecurityMaps -> {"); 444 for (int i=0; i<securityMaps.length; i++) { 445 if ( securityMaps[i] != null && 446 securityMaps[i].getName() != null ) { 447 sb.append(securityMaps[i].getName()+" "); 448 } 449 } 450 sb.append("}"); 451 } 452 returnVal = sb.toString(); 453 } catch( Exception e) { 454 e.printStackTrace(); 455 } 456 return returnVal; 457 } 458 459 public boolean isValidateAtmostEveryIdleSecs() { 460 return validateAtmostEveryIdleSecs; 461 } 462 public void setValidateAtmostEveryIdleSecs(boolean validateAtmostEveryIdleSecs) { 463 this.validateAtmostEveryIdleSecs = validateAtmostEveryIdleSecs; 464 } 465 466 } 467 | Popular Tags |