Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   *
   * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.
   *
   * The contents of this file are subject to the terms of either the GNU
   * General Public License Version 2 only ("GPL") or the Common Development
   * and Distribution License("CDDL") (collectively, the "License").  You
   * may not use this file except in compliance with the License.  You can
  * obtain a copy of the License at
  * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
  * or packager/legal/LICENSE.txt.  See the License for the specific
  * language governing permissions and limitations under the License.
  *
  * When distributing the software, include this License Header Notice in each
  * file and include the License file at packager/legal/LICENSE.txt.
  *
  * GPL Classpath Exception:
  * Oracle designates this particular file as subject to the "Classpath"
  * exception as provided by Oracle in the GPL Version 2 section of the License
  * file that accompanied this code.
  *
  * Modifications:
  * If applicable, add the following below the License Header, with the fields
  * enclosed by brackets [] replaced by your own identifying information:
  * "Portions Copyright [year] [name of copyright owner]"
  *
  * Contributor(s):
  * If you wish your version of this file to be governed by only the CDDL or
  * only the GPL Version 2, indicate your decision by adding "[Contributor]
  * elects to include this software in this distribution under the [CDDL or GPL
  * Version 2] license."  If you don't indicate a single choice of license, a
  * recipient has the option to distribute your version of this file under
  * either the CDDL, the GPL Version 2 or to extend the choice of license to
  * its licensees as provided above.  However, if you add GPL Version 2 code
  * and therefore, elected the GPL Version 2 license, then the option applies
  * only if the new code is made subject to such option by the copyright
  * holder.
  */
 
 package com.sun.enterprise.connectors;
 
 
This class abstracts a connection connection pool. It contains two parts 1) Connector Connection Pool properties. 2) ConnectorDescriptorInfo which contains some of the values of ra.xml pertaining to managed connection factory class

Author(s):
Srikanth Padakandla
 
 
 public class ConnectorConnectionPool implements Serializable {
 
 
     protected String steadyPoolSize_;
     protected String maxPoolSize_;
     protected String maxWaitTimeInMillis_;
     protected String poolResizeQuantity_;
     protected String idleTimeoutInSeconds_;
     protected boolean failAllConnections_;
     //This property will *always* initially be set to:
     // true - by ConnectorConnectionPoolDeployer
     // false - by JdbcConnectionPoolDeployer
     protected boolean matchConnections_ = false;
 
     protected int transactionSupport_;
     protected boolean isConnectionValidationRequired_ = false;
 
 
     private boolean lazyConnectionAssoc_ = false;
     private boolean lazyConnectionEnlist_ = false;
     private boolean associateWithThread_ = false;
     private boolean partitionedPool = false;
     private boolean poolingOn = true;
     private boolean pingDuringPoolCreation = false;
     private String poolDataStructureType;
     private String poolWaitQueue;
     private String dataStructureParameters;
     private String resourceGatewayClass;
     private boolean nonTransactional_ = false;
     private boolean nonComponent_ = false;
 
     private long dynamicReconfigWaitTimeout = 0;
 
     private ConnectorSecurityMap[] securityMaps = null;
     private boolean isAuthCredentialsDefinedInPool_ = false;
 
    private String maxConnectionUsage;
    //To validate a Sun RA Pool Connection if it hasnot been
    //validated in the past x sec. (x=idle-timeout)
    //The property will be set from system property :
    //com.sun.enterprise.connectors.ValidateAtmostEveryIdleSecs=true
    private boolean validateAtmostEveryIdleSecs = false;
    //This property will be set by ConnectorConnectionPoolDeployer or
    //JdbcConnectionPoolDeployer.
    private boolean preferValidateOverRecreate_ = false;
    
    private String validateAtmostOncePeriod_ = null;
    private String conCreationRetryAttempts_ = null;
    private String conCreationRetryInterval_ = null;
    private String connectionLeakTracingTimeout_ = null;
    private boolean connectionReclaim_ = false;
    public static final String DEFAULT_MAX_CONNECTION_USAGE = "0";
    public static final String DEFAULT_CON_CREATION_RETRY_ATTEMPTS = "0";
    public static final String DEFAULT_CON_CREATION_RETRY_INTERVAL = "10";
    public static final String DEFAULT_VALIDATE_ATMOST_ONCE_PERIOD = "0";
    public static final String DEFAULT_LEAK_TIMEOUT = "0";
    private static Logger _logger = LogDomains.getLogger(ConnectorConnectionPool.class.);
    private String name;
    private String applicationName;
    private String moduleName;


    
Constructor

Parameters:
name Name of the connector connection pool
    public ConnectorConnectionPool(String nameString applicationName) {
        this. = name;
        this. = applicationName;
    }

    
Constructor

Parameters:
name Name of the connector connection pool
    public ConnectorConnectionPool(String nameString applicationNameString moduleName) {
        this. = name;
        this. = applicationName;
        this. = moduleName;
    }

    
Constructor

Parameters:
name Name of the connector connection pool
    public ConnectorConnectionPool(String name) {
        this. = name;
    }
    public ConnectorConnectionPool(PoolInfo poolInfo){
        this. = poolInfo.getName();
        this. = poolInfo.getApplicationName();
        this. = poolInfo.getModuleName();
    }
    public String getApplicationName(){
        return ;
    }
    public void setApplicationName(String applicationName){
        this. = applicationName;
    }
    public String getModuleName(){
        return ;
    }
    public void setModuleName(String moduleName){
        this. = moduleName;
    }
    public boolean isApplicationScopedResource(){
        return  != null;
    }
    public boolean getPingDuringPoolCreation() {
        return ;
    }

    
Setter method of Ping pool during creation attribute.

Parameters:
enabled enables/disables ping during creation.
    public void setPingDuringPoolCreation(boolean enabled) {
         = enabled;    
    }
    
    public boolean isPoolingOn() {
        return ;
    }
    
    
Setter method of pooling attribute

Parameters:
enabled enables/disables pooling
    public void setPooling(boolean enabled) {
         = enabled;
    }
    
Clone method.
    protected ConnectorConnectionPool doClone(String name) {
        ConnectorConnectionPool clone = new ConnectorConnectionPool(name);
        clone.setSecurityMaps(this.);
        clone.setSteadyPoolSize(getSteadyPoolSize());
        clone.setMaxPoolSize(getMaxPoolSize());
        clone.setConnectorDescriptorInfo(cdi);
        clone.setNonComponent(isNonComponent());
        clone.setNonTransactional(isNonTransactional());
        clone.setMatchConnections(matchConnections());
        clone.setPartitionedPool(isPartitionedPool());
        clone.setPoolWaitQueue(getPoolWaitQueue());
        clone.setConnectionLeakTracingTimeout(
                getConnectionLeakTracingTimeout());
        clone.setConCreationRetryInterval
                (getConCreationRetryInterval());
        clone.setPooling(isPoolingOn());
        return clone;
    }
    public String getName() {
        return ;
    }
    public void setAuthCredentialsDefinedInPool(boolean authCred) {
        this. = authCred;
    }
    public boolean getAuthCredentialsDefinedInPool() {
        return this.;
    }

    
Getter method of ConnectorDescriptorInfo which contains some the ra.xml values pertainining to managed connection factory

Returns:
ConnectorDescriptorInfo which contains ra.xml values pertaining to managed connection factory
        return ;
    }

    
Setter method of ConnectorDescriptorInfo which contains some the ra.xml values pertainining to managed connection factory

Parameters:
connectorDescriptorInfo which contains ra.xml values pertaining to managed connection factory
    public void setConnectorDescriptorInfo(
            ConnectorDescriptorInfo connectorDescriptorInfo) {
         = connectorDescriptorInfo;
    }


    
Getter method of SteadyPoolSize property

Returns:
Steady Pool Size value
    public String getSteadyPoolSize() {
        return ;
    }

    
Setter method of SteadyPoolSize property

Parameters:
steadyPoolSize Steady pool size value
    public void setSteadyPoolSize(String steadyPoolSize) {
         = steadyPoolSize;
    }

    
Getter method of MaxPoolSize property

Returns:
maximum Pool Size value
    public String getMaxPoolSize() {
        return ;
    }

    
Setter method of MaxPoolSize property

Parameters:
maxPoolSize maximum pool size value
    public void setMaxPoolSize(String maxPoolSize) {
         = maxPoolSize;
    }

    
Getter method of MaxWaitTimeInMillis property

Returns:
maximum wait time in milli value
    public String getMaxWaitTimeInMillis() {
        return ;
    }

    
Setter method of MaxWaitTimeInMillis property

Parameters:
maxWaitTimeInMillis maximum wait time in millis value
    public void setMaxWaitTimeInMillis(String maxWaitTimeInMillis) {
         = maxWaitTimeInMillis;
    }

    
Getter method of PoolResizeQuantity property

Returns:
pool resize quantity value
    public String getPoolResizeQuantity() {
        return ;
    }

    
Setter method of PoolResizeQuantity property

Parameters:
poolResizeQuantity pool resize quantity value
    public void setPoolResizeQuantity(String poolResizeQuantity) {
         = poolResizeQuantity;
    }

    
Getter method of IdleTimeoutInSeconds property

Returns:
idle Timeout in seconds value
    public String getIdleTimeoutInSeconds() {
        return ;
    }

    
Setter method of IdleTimeoutInSeconds property

Parameters:
idleTimeoutInSeconds Idle timeout in seconds value
    public void setIdleTimeoutInSeconds(String idleTimeoutInSeconds) {
         = idleTimeoutInSeconds;
    }

    
Getter method of FailAllConnections property

Returns:
whether to fail all connections or not
    public boolean isFailAllConnections() {
        return ;
    }

    
Setter method of FailAllConnections property

Parameters:
failAllConnections fail all connections value
    public void setFailAllConnections(boolean failAllConnections) {
         = failAllConnections;
    }

    
Getter method of matchConnections property

Returns:
whether to match connections always with resource adapter or not
    public boolean matchConnections() {
        return ;
    }

    
Setter method of matchConnections property

Parameters:
matchConnections fail all connections value
    public void setMatchConnections(boolean matchConnections) {
         = matchConnections;
    }

    
Returns the transaction support level for this pool The valid values are
  • ConnectorConstants.NO_TRANSACTION
  • ConnectorConstants.LOCAL_TRANSACTION
  • ConnectorConstants.XA_TRANSACTION

Returns:
the transaction support level for this pool
    public int getTransactionSupport() {
        return ;
    }

    
Sets the transaction support level for this pool The valid values are

Parameters:
transactionSupport int representing transaction support
  • ConnectorConstants.NO_TRANSACTION
  • ConnectorConstants.LOCAL_TRANSACTION
  • ConnectorConstants.XA_TRANSACTION
    public void setTransactionSupport(int transactionSupport) {
         = transactionSupport;
    }

    
Sets the connection-validation-required pool attribute

Parameters:
validation boolean representing validation requirement
    public void setConnectionValidationRequired(boolean validation) {
         = validation;
    }

    
Queries the connection-validation-required pool attribute

Returns:
boolean representing validation requirement
    public boolean isIsConnectionValidationRequired() {
        return ;
    }

    
Queries the lazy-connection-association pool attribute

Returns:
boolean representing lazy-connection-association status
    public boolean isLazyConnectionAssoc() {
        return ;
    }

    
Setter method of lazyConnectionAssociation attribute

Parameters:
enabled enables/disables lazy-connection-association
    public void setLazyConnectionAssoc(boolean enabled) {
         = enabled;
    }

    
Queries the lazy-connection-enlistment pool attribute

Returns:
boolean representing lazy-connection-enlistment status
    public boolean isLazyConnectionEnlist() {
        return ;
    }

    
Setter method of lazy-connection-enlistment attribute

Parameters:
enabled enables/disables lazy-connection-enlistment
    public void setLazyConnectionEnlist(boolean enabled) {
         = enabled;
    }

    
Queries the associate-with-thread pool attribute

Returns:
boolean representing associate-with-thread status
    public boolean isAssociateWithThread() {
        return ;
    }

    
Setter method of associate-with-thread attribute

Parameters:
enabled enables/disables associate-with-thread
    public void setAssociateWithThread(boolean enabled) {
         = enabled;
    }

    
Queries the non-transactional pool attribute

Returns:
boolean representing non-transactional status
    public boolean isNonTransactional() {
        return ;
    }

    
Setter method of non-transactional attribute

Parameters:
enabled enables/disables non-transactional status
    public void setNonTransactional(boolean enabled) {
         = enabled;
    }

    
Queries the non-component pool attribute

Returns:
boolean representing non-component status
    public boolean isNonComponent() {
        return ;
    }

    
Setter method of non-component attribute

Parameters:
enabled enables/disables non-component status
    public void setNonComponent(boolean enabled) {
         = enabled;
    }

    
Queries the connection-leak-tracing-timeout pool attribute

Returns:
boolean representing connection-leak-tracing-timeout status
        return ;
    }

    
Setter method of connection-leak-tracing-timeout attribute

Parameters:
timeout value after which connection is assumed to be leaked.
    public void setConnectionLeakTracingTimeout(String timeout) {
         = timeout;
    }


    
Setter method for Security Maps

Parameters:
securityMapArray SecurityMap[]
    public void setSecurityMaps(ConnectorSecurityMap[] securityMapArray) {
        this. = securityMapArray;
    }

    
Getter method for Security Maps

Returns:
SecurityMap[]
        return this.;
    }


    
Queries the validate-atmost-every-idle-seconds pool attribute

Returns:
boolean representing validate-atmost-every-idle-seconds status
    public boolean isValidateAtmostEveryIdleSecs() {
        return ;
    }

    
Setter method of validate-atmost-every-idle-seconds pool attribute

Parameters:
enabled enables/disables validate-atmost-every-idle-seconds property
    public void setValidateAtmostEveryIdleSecs(boolean enabled) {
        this. = enabled;
    }

    
Setter method of max-connection-usage pool attribute

Parameters:
count max-connection-usage count
    public void setMaxConnectionUsage(String count) {
         = count;
    }

    
Queries the max-connection-usage pool attribute

Returns:
boolean representing max-connection-usage count
    public String getMaxConnectionUsage() {
        return ;
    }

    
Queries the connection-creation-retry-interval pool attribute

Returns:
boolean representing connection-creation-retry-interval duration
        return ;
    }

    
Setter method of connection-creation-retry-interval attribute

Parameters:
retryInterval connection-creation-retry-interval duration
    public void setConCreationRetryInterval(String retryInterval) {
        this. = retryInterval;
    }

    
Queries the connection-creation-retry-attempt pool attribute

Returns:
boolean representing connection-creation-retry-attempt count
        return ;
    }

    
Setter method of connection-creation-retry-attempt attribute

Parameters:
retryAttempts connection-creation-retry-attempt interval duration
    public void setConCreationRetryAttempts(String retryAttempts) {
        this. = retryAttempts;
    }

    
Queries the validate-atmost-period pool attribute

Returns:
boolean representing validate-atmost-period duration
        return ;
    }

    
Setter method of validate-atmost-period attribute

Parameters:
validateAtmostOncePeriod validate-atmost-period duration
    public void setValidateAtmostOncePeriod(String validateAtmostOncePeriod) {
        this. = validateAtmostOncePeriod;
    }

    
Queries the connection-reclaim attribute

Returns:
boolean representing connection-reclaim status
    public boolean isConnectionReclaim() {
        return ;
    }

    
Setter method of connection-reclaim attribute

Parameters:
connectionReclaim onnection-reclaim status
    public void setConnectionReclaim(boolean connectionReclaim) {
        this. = connectionReclaim;
    }

    
return the String representation of the pool.

Returns:
String representation of pool
    public String toString() {
        String returnVal = "";
        StringBuffer sb = new StringBuffer("ConnectorConnectionPool :: ");
        try {
            sb.append(getName());
            sb.append("\nsteady size: ");
            sb.append(getSteadyPoolSize());
            sb.append("\nmax pool size: ");
            sb.append(getMaxPoolSize());
            sb.append("\nmax wait time: ");
            sb.append(getMaxWaitTimeInMillis());
            sb.append("\npool resize qty: ");
            sb.append(getPoolResizeQuantity());
            sb.append("\nIdle timeout: ");
            sb.append(getIdleTimeoutInSeconds());
            sb.append("\nfailAllConnections: ");
            sb.append(isFailAllConnections());
            sb.append("\nTransaction Support Level: ");
            sb.append();
            sb.append("\nisConnectionValidationRequired_ ");
            sb.append();
            sb.append("\npreferValidateOverRecreate_ ");
            sb.append();
            sb.append("\nmatchConnections_ ");
            sb.append();
            sb.append("\nassociateWithThread_ ");
            sb.append();
            sb.append("\nlazyConnectionAssoc_ ");
            sb.append();
            sb.append("\nlazyConnectionEnlist_ ");
            sb.append();
            sb.append("\nmaxConnectionUsage_ ");
            sb.append();
            sb.append("\npingPoolDuringCreation_ ");
            sb.append();
            sb.append("\npoolingOn_ ");
            sb.append();
            sb.append("\nvalidateAtmostOncePeriod_ ");
            sb.append();
            sb.append("\nconnectionLeakTracingTimeout_");
            sb.append();
            sb.append("\nconnectionReclaim_");
            sb.append();
            sb.append("\nconnectionCreationRetryAttempts_");
            sb.append();
            sb.append("\nconnectionCreationRetryIntervalInMilliSeconds_");
            sb.append();
            sb.append("\nnonTransactional_ ");
            sb.append();
            sb.append("\nnonComponent_ ");
            sb.append();
            sb.append("\nConnectorDescriptorInfo -> ");
            sb.append("\nrarName: ");
            if ( != null) {
                sb.append(.getRarName());
                sb.append("\nresource adapter class: ");
                sb.append(.getResourceAdapterClassName());
                sb.append("\nconnection def name: ");
                sb.append(.getConnectionDefinitionName());
                sb.append("\nMCF Config properties-> ");
                for (Object o : .getMCFConfigProperties()) {
                    ConnectorConfigProperty  ep = (ConnectorConfigPropertyo;
                    sb.append(ep.getName());
                    sb.append(":");
                    sb.append(("password".equalsIgnoreCase(ep.getName()) ?
                            "****" : ep.getValue()));
                    sb.append("\n");
                }
            }
            if ( != null) {
                sb.append("SecurityMaps -> {");
                for (ConnectorSecurityMap securityMap : ) {
                    if (securityMap != null &&
                            securityMap.getName() != null) {
                        sb.append(securityMap.getName());
                        sb.append(" ");
                    }
                }
                sb.append("}");
            }
            returnVal = sb.toString();
        } catch (Exception e) {
            .log(."Exception while computing toString() of connection pool [ "++" ]"e);
        }
        return returnVal;
    }
    public boolean isPartitionedPool() {
        return ;
    }
    public void setPartitionedPool(boolean partitionedPool) {
        this. = partitionedPool;
    }
    public String getPoolDataStructureType() {
        return ;
    }
    public void setPoolDataStructureType(String poolDataStructureType) {
        this. = poolDataStructureType;
    }
    public String getPoolWaitQueue() {
        return ;
    }
    public void setPoolWaitQueue(String poolWaitQueue) {
        this. = poolWaitQueue;
    }
        return ;
    }
    public void setDataStructureParameters(String dataStructureParameters) {
        this. = dataStructureParameters;
    }
    public String getResourceGatewayClass() {
        return ;
    }
    public void setResourceGatewayClass(String resourceGatewayClass) {
        this. = resourceGatewayClass;
    }
        return ;
    }
    public void setResourceSelectionStrategyClass(String resourceSelectionStrategyClass) {
        this. = resourceSelectionStrategyClass;
    }
    public boolean isPreferValidateOverRecreate() {
        return ;
    }
    public void setPreferValidateOverRecreate(boolean preferValidateOverRecreate) {
         = preferValidateOverRecreate;
    }
    public long getDynamicReconfigWaitTimeout() {
        return ;
    }
    public void setDynamicReconfigWaitTimeout(long dynamicReconfigWaitTimeout) {
        this. = dynamicReconfigWaitTimeout;
    }
    public PoolInfo getPoolInfo(){
        if( != null &&  != null){
            return new PoolInfo();
        }else if( != null){
            return new PoolInfo();
        }else{
            return new PoolInfo();
        }
    }
New to GrepCode? Check out our FAQ X