FileDocCategorySizeDatePackage
ConnectorConnectionPool.javaAPI DocGlassfish v2 API22903Fri May 04 22:34:24 BST 2007com.sun.enterprise.connectors

ConnectorConnectionPool

public class ConnectorConnectionPool extends com.sun.enterprise.repository.J2EEResourceBase implements Serializable
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
Srikanth Padakandla

Fields Summary
protected ConnectorDescriptorInfo
connectorDescriptorInfo_
protected String
steadyPoolSize_
protected String
maxPoolSize_
protected String
maxWaitTimeInMillis_
protected String
poolResizeQuantity_
protected String
idleTimeoutInSeconds_
protected boolean
failAllConnections_
protected boolean
matchConnections_
protected int
transactionSupport_
protected boolean
isConnectionValidationRequired_
private boolean
lazyConnectionAssoc_
private boolean
lazyConnectionEnlist_
private boolean
associateWithThread_
private boolean
nonTransactional_
private boolean
nonComponent_
private com.sun.enterprise.connectors.authentication.ConnectorSecurityMap[]
securityMaps
private boolean
isAuthCredentialsDefinedInPool_
private String
maxConnectionUsage
private boolean
validateAtmostEveryIdleSecs
private String
validateAtmostOncePeriod_
private String
conCreationRetryAttempts_
private String
conCreationRetryInterval_
private String
connectionLeakTracingTimeout_
private boolean
connectionReclaim_
public static final String
DEFAULT_MAX_CONNECTION_USAGE
public static final String
DEFAULT_CON_CREATION_RETRY_ATTEMPTS
public static final String
DEFAULT_CON_CREATION_RETRY_INTERVAL
public static final String
DEFAULT_VALIDATE_ATMOST_ONCE_PERIOD
public static final String
DEFAULT_LEAK_TIMEOUT
Constructors Summary
public ConnectorConnectionPool(String name)
Constructor

param
name Name of the connector connection pool



                  

       
        super(name);
    
Methods Summary
protected com.sun.enterprise.repository.J2EEResourcedoClone(java.lang.String name)
Clone method.


        ConnectorConnectionPool clone = new ConnectorConnectionPool(name);
        ConnectorDescriptorInfo cdi = connectorDescriptorInfo_.doClone();
        clone.setSecurityMaps(this.securityMaps);

        clone.setSteadyPoolSize(getSteadyPoolSize());
        clone.setMaxPoolSize(getMaxPoolSize());
        clone.setMaxWaitTimeInMillis(getMaxWaitTimeInMillis());
        clone.setPoolResizeQuantity(getPoolResizeQuantity());
        clone.setIdleTimeoutInSeconds(getIdleTimeoutInSeconds());

        clone.setConnectionValidationRequired(isConnectionValidationRequired_);
        clone.setFailAllConnections(isFailAllConnections());

        clone.setTransactionSupport(getTransactionSupport());
        clone.setConnectorDescriptorInfo(cdi);
        clone.setNonComponent(isNonComponent());
        clone.setNonTransactional(isNonTransactional());

        clone.setMatchConnections(matchConnections());
        clone.setLazyConnectionAssoc(isLazyConnectionAssoc());
        clone.setAssociateWithThread(isAssociateWithThread());
        clone.setLazyConnectionEnlist(isLazyConnectionEnlist());

        clone.setMaxConnectionUsage(getMaxConnectionUsage());
        clone.setValidateAtmostOncePeriod(getValidateAtmostOncePeriod());


        clone.setConnectionLeakTracingTimeout(
                getConnectionLeakTracingTimeout());
        clone.setConCreationRetryInterval
                (getConCreationRetryInterval());
        clone.setConCreationRetryAttempts(getConCreationRetryAttempts());

        return clone;
    
public booleangetAuthCredentialsDefinedInPool()

        return this.isAuthCredentialsDefinedInPool_;
    
public java.lang.StringgetConCreationRetryAttempts()
Queries the connection-creation-retry-attempt pool attribute

return
boolean representing connection-creation-retry-attempt count

        return conCreationRetryAttempts_;
    
public java.lang.StringgetConCreationRetryInterval()
Queries the connection-creation-retry-interval pool attribute

return
boolean representing connection-creation-retry-interval duration

        return conCreationRetryInterval_;
    
public java.lang.StringgetConnectionLeakTracingTimeout()
Queries the connection-leak-tracing-timeout pool attribute

return
boolean representing connection-leak-tracing-timeout status

        return connectionLeakTracingTimeout_;
    
public ConnectorDescriptorInfogetConnectorDescriptorInfo()
Getter method of ConnectorDescriptorInfo which contains some the ra.xml values pertainining to managed connection factory

return
ConnectorDescriptorInfo which contains ra.xml values pertaining to managed connection factory

        return connectorDescriptorInfo_;
    
public java.lang.StringgetIdleTimeoutInSeconds()
Getter method of IdleTimeoutInSeconds property

return
idle Timeout in seconds value

        return idleTimeoutInSeconds_;
    
public java.lang.StringgetMaxConnectionUsage()
Queries the max-connection-usage pool attribute

return
boolean representing max-connection-usage count

        return maxConnectionUsage;
    
public java.lang.StringgetMaxPoolSize()
Getter method of MaxPoolSize property

return
maximum Pool Size value

        return maxPoolSize_;
    
public java.lang.StringgetMaxWaitTimeInMillis()
Getter method of MaxWaitTimeInMillis property

return
maximum wait time in milli value

        return maxWaitTimeInMillis_;
    
public java.lang.StringgetPoolResizeQuantity()
Getter method of PoolResizeQuantity property

return
pool resize quantity value

        return poolResizeQuantity_;
    
public com.sun.enterprise.connectors.authentication.ConnectorSecurityMap[]getSecurityMaps()
Getter method for Security Maps

return
SecurityMap[]

        return this.securityMaps;
    
public java.lang.StringgetSteadyPoolSize()
Getter method of SteadyPoolSize property

return
Steady Pool Size value

        return steadyPoolSize_;
    
public intgetTransactionSupport()
Returns the transaction support level for this pool The valid values are
  • ConnectorConstants.NO_TRANSACTION
  • ConnectorConstants.LOCAL_TRANSACTION
  • ConnectorConstants.XA_TRANSACTION

return
the transaction support level for this pool

        return transactionSupport_;
    
public intgetType()
Getter method of the Resource Type.

return
Resource type

        return J2EEResource.JDBC_CONNECTION_POOL;
    
public java.lang.StringgetValidateAtmostOncePeriod()
Queries the validate-atmost-period pool attribute

return
boolean representing validate-atmost-period duration

        return validateAtmostOncePeriod_;
    
public booleanisAssociateWithThread()
Queries the associate-with-thread pool attribute

return
boolean representing associate-with-thread status

        return associateWithThread_;
    
public booleanisConnectionReclaim()
Queries the connection-reclaim attribute

return
boolean representing connection-reclaim status

        return connectionReclaim_;
    
public booleanisFailAllConnections()
Getter method of FailAllConnections property

return
whether to fail all connections or not

        return failAllConnections_;
    
public booleanisIsConnectionValidationRequired()
Queries the connection-validation-required pool attribute

return
boolean representing validation requirement

        return isConnectionValidationRequired_;
    
public booleanisLazyConnectionAssoc()
Queries the lazy-connection-association pool attribute

return
boolean representing lazy-connection-association status

        return lazyConnectionAssoc_;
    
public booleanisLazyConnectionEnlist()
Queries the lazy-connection-enlistment pool attribute

return
boolean representing lazy-connection-enlistment status

        return lazyConnectionEnlist_;
    
public booleanisNonComponent()
Queries the non-component pool attribute

return
boolean representing non-component status

        return nonComponent_;
    
public booleanisNonTransactional()
Queries the non-transactional pool attribute

return
boolean representing non-transactional status

        return nonTransactional_;
    
public booleanisValidateAtmostEveryIdleSecs()
Queries the validate-atmost-every-idle-seconds pool attribute

return
boolean representing validate-atmost-every-idle-seconds status

        return validateAtmostEveryIdleSecs;
    
public booleanmatchConnections()
Getter method of matchConnections property

return
whether to match connections always with resource adapter or not

        return matchConnections_;
    
public voidsetAssociateWithThread(boolean enabled)
Setter method of associate-with-thread attribute

param
enabled enables/disables associate-with-thread

        associateWithThread_ = enabled;
    
public voidsetAuthCredentialsDefinedInPool(boolean authCred)

        this.isAuthCredentialsDefinedInPool_ = authCred;
    
public voidsetConCreationRetryAttempts(java.lang.String retryAttempts)
Setter method of connection-creation-retry-attempt attribute

param
retryAttempts connection-creation-retry-attempt interval duration

        this.conCreationRetryAttempts_ = retryAttempts;
    
public voidsetConCreationRetryInterval(java.lang.String retryInterval)
Setter method of connection-creation-retry-interval attribute

param
retryInterval connection-creation-retry-interval duration

        this.conCreationRetryInterval_ = retryInterval;
    
public voidsetConnectionLeakTracingTimeout(java.lang.String timeout)
Setter method of connection-leak-tracing-timeout attribute

param
timeout value after which connection is assumed to be leaked.

        connectionLeakTracingTimeout_ = timeout;
    
public voidsetConnectionReclaim(boolean connectionReclaim)
Setter method of connection-reclaim attribute

param
connectionReclaim onnection-reclaim status

        this.connectionReclaim_ = connectionReclaim;
    
public voidsetConnectionValidationRequired(boolean validation)
Sets the connection-validation-required pool attribute

param
validation boolean representing validation requirement

        isConnectionValidationRequired_ = validation;
    
public voidsetConnectorDescriptorInfo(ConnectorDescriptorInfo connectorDescriptorInfo)
Setter method of ConnectorDescriptorInfo which contains some the ra.xml values pertainining to managed connection factory

param
connectorDescriptorInfo which contains ra.xml values pertaining to managed connection factory

        connectorDescriptorInfo_ = connectorDescriptorInfo;
    
public voidsetFailAllConnections(boolean failAllConnections)
Setter method of FailAllConnections property

param
failAllConnections fail all connections value

        failAllConnections_ = failAllConnections;
    
public voidsetIdleTimeoutInSeconds(java.lang.String idleTimeoutInSeconds)
Setter method of IdleTimeoutInSeconds property

param
idleTimeoutInSeconds Idle timeout in seconds value

        idleTimeoutInSeconds_ = idleTimeoutInSeconds;
    
public voidsetLazyConnectionAssoc(boolean enabled)
Setter method of lazyConnectionAssociation attribute

param
enabled enables/disables lazy-connection-association

        lazyConnectionAssoc_ = enabled;
    
public voidsetLazyConnectionEnlist(boolean enabled)
Setter method of lazy-connection-enlistment attribute

param
enabled enables/disables lazy-connection-enlistment

        lazyConnectionEnlist_ = enabled;
    
public voidsetMatchConnections(boolean matchConnections)
Setter method of matchConnections property

param
matchConnections fail all connections value

        matchConnections_ = matchConnections;
    
public voidsetMaxConnectionUsage(java.lang.String count)
Setter method of max-connection-usage pool attribute

param
count max-connection-usage count

        maxConnectionUsage = count;
    
public voidsetMaxPoolSize(java.lang.String maxPoolSize)
Setter method of MaxPoolSize property

param
maxPoolSize maximum pool size value

        maxPoolSize_ = maxPoolSize;
    
public voidsetMaxWaitTimeInMillis(java.lang.String maxWaitTimeInMillis)
Setter method of MaxWaitTimeInMillis property

param
maxWaitTimeInMillis maximum wait time in millis value

        maxWaitTimeInMillis_ = maxWaitTimeInMillis;
    
public voidsetNonComponent(boolean enabled)
Setter method of non-component attribute

param
enabled enables/disables non-component status

        nonComponent_ = enabled;
    
public voidsetNonTransactional(boolean enabled)
Setter method of non-transactional attribute

param
enabled enables/disables non-transactional status

        nonTransactional_ = enabled;
    
public voidsetPoolResizeQuantity(java.lang.String poolResizeQuantity)
Setter method of PoolResizeQuantity property

param
poolResizeQuantity pool resize quantity value

        poolResizeQuantity_ = poolResizeQuantity;
    
public voidsetSecurityMaps(com.sun.enterprise.connectors.authentication.ConnectorSecurityMap[] securityMapArray)
Setter method for Security Maps

param
securityMapArray SecurityMap[]

        this.securityMaps = securityMapArray;
    
public voidsetSteadyPoolSize(java.lang.String steadyPoolSize)
Setter method of SteadyPoolSize property

param
steadyPoolSize Steady pool size value

        steadyPoolSize_ = steadyPoolSize;
    
public voidsetTransactionSupport(int transactionSupport)
Sets the transaction support level for this pool The valid values are

param
transactionSupport int representing transaction support
  • ConnectorConstants.NO_TRANSACTION
  • ConnectorConstants.LOCAL_TRANSACTION
  • ConnectorConstants.XA_TRANSACTION

        transactionSupport_ = transactionSupport;
    
public voidsetValidateAtmostEveryIdleSecs(boolean enabled)
Setter method of validate-atmost-every-idle-seconds pool attribute

param
enabled enables/disables validate-atmost-every-idle-seconds property

        this.validateAtmostEveryIdleSecs = enabled;
    
public voidsetValidateAtmostOncePeriod(java.lang.String validateAtmostOncePeriod)
Setter method of validate-atmost-period attribute

param
validateAtmostOncePeriod validate-atmost-period duration

        this.validateAtmostOncePeriod_ = validateAtmostOncePeriod;
    
public java.lang.StringtoString()
return the String representation of the pool.

return
String representation of pool

        String returnVal = null;
        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(transactionSupport_);
            sb.append("\nisConnectionValidationRequired_ ");
            sb.append(isConnectionValidationRequired_);

            sb.append("\nmatchConnections_ ");
            sb.append(matchConnections_);
            sb.append("\nassociateWithThread_ ");
            sb.append(associateWithThread_);
            sb.append("\nlazyConnectionAssoc_ ");
            sb.append(lazyConnectionAssoc_);
            sb.append("\nlazyConnectionEnlist_ ");
            sb.append(lazyConnectionEnlist_);
            sb.append("\nmaxConnectionUsage_ ");
            sb.append(maxConnectionUsage);

            sb.append("\nvalidateAtmostOncePeriod_ ");
            sb.append(validateAtmostOncePeriod_);

            sb.append("\nconnectionLeakTracingTimeout_");
            sb.append(connectionLeakTracingTimeout_);
            sb.append("\nconnectionReclaim_");
            sb.append(connectionReclaim_);

            sb.append("\nconnectionCreationRetryAttempts_");
            sb.append(conCreationRetryAttempts_);
            sb.append("\nconnectionCreationRetryIntervalInMilliSeconds_");
            sb.append(conCreationRetryInterval_);

            sb.append("\nnonTransactional_ ");
            sb.append(nonTransactional_);
            sb.append("\nnonComponent_ ");
            sb.append(nonComponent_);

            sb.append("\nConnectorDescriptorInfo -> ");
            sb.append("\nrarName: ");
            if (connectorDescriptorInfo_ != null) {
                sb.append(connectorDescriptorInfo_.getRarName());
                sb.append("\nresource adapter class: ");
                sb.append(connectorDescriptorInfo_.getResourceAdapterClassName());
                sb.append("\nconnection def name: ");
                sb.append(connectorDescriptorInfo_.getConnectionDefinitionName());
                sb.append("\nMCF Config properties-> ");
                for (Object o : connectorDescriptorInfo_.getMCFConfigProperties()) {
                    EnvironmentProperty ep = (EnvironmentProperty) o;
                    sb.append(ep.getName());
                    sb.append(":");
                    sb.append(("password".equalsIgnoreCase(ep.getName()) ?
                            "****" : ep.getValue()));
                    sb.append("\n");
                }
            }
            if (securityMaps != null) {
                sb.append("SecurityMaps -> {");
                for (ConnectorSecurityMap securityMap : securityMaps) {
                    if (securityMap != null &&
                            securityMap.getName() != null) {
                        sb.append(securityMap.getName());
                        sb.append(" ");
                    }
                }
                sb.append("}");
            }
            returnVal = sb.toString();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return returnVal;