Apache Tomcat 7.0.23

org.apache.tomcat.jdbc.pool
Class PoolProperties

java.lang.Object
  extended by org.apache.tomcat.jdbc.pool.PoolProperties
All Implemented Interfaces:
PoolConfiguration

public class PoolProperties
extends java.lang.Object
implements PoolConfiguration

Author:
Filip Hanik

Nested Class Summary
static class PoolProperties.InterceptorDefinition
           
static class PoolProperties.InterceptorProperty
           
 
Field Summary
protected  int abandonWhenPercentageFull
           
protected  boolean accessToUnderlyingConnectionAllowed
           
protected  boolean alternateUsernameAllowed
           
protected  java.lang.String connectionProperties
           
protected  java.lang.Object dataSource
           
protected  java.lang.String dataSourceJNDI
           
protected  java.util.Properties dbProperties
           
static int DEFAULT_MAX_ACTIVE
           
protected  java.lang.Boolean defaultAutoCommit
           
protected  java.lang.String defaultCatalog
           
protected  java.lang.Boolean defaultReadOnly
           
protected  int defaultTransactionIsolation
           
protected  java.lang.String driverClassName
           
protected  boolean fairQueue
           
protected  int initialSize
           
protected  java.lang.String initSQL
           
protected  PoolProperties.InterceptorDefinition[] interceptors
           
protected  java.lang.String jdbcInterceptors
           
protected  boolean jmxEnabled
           
protected  boolean logAbandoned
           
protected  int maxActive
           
protected  long maxAge
           
protected  int maxIdle
           
protected  int maxWait
           
protected  int minEvictableIdleTimeMillis
           
protected  int minIdle
           
protected  java.lang.String name
           
protected  int numTestsPerEvictionRun
           
protected  java.lang.String password
           
protected static java.util.concurrent.atomic.AtomicInteger poolCounter
           
protected  boolean removeAbandoned
           
protected  int removeAbandonedTimeout
           
protected  int suspectTimeout
           
protected  boolean testOnBorrow
           
protected  boolean testOnConnect
           
protected  boolean testOnReturn
           
protected  boolean testWhileIdle
           
protected  int timeBetweenEvictionRunsMillis
           
protected  java.lang.String url
           
protected  boolean useEquals
           
protected  boolean useLock
           
protected  java.lang.String username
           
protected  long validationInterval
           
protected  java.lang.String validationQuery
           
protected  Validator validator
           
protected  java.lang.String validatorClassName
           
 
Fields inherited from interface org.apache.tomcat.jdbc.pool.PoolConfiguration
PKG_PREFIX
 
Constructor Summary
PoolProperties()
           
 
Method Summary
 int getAbandonWhenPercentageFull()
          Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are above the percentage defined by abandonWhenPercentageFull.
 java.lang.String getConnectionProperties()
          The connection properties that will be sent to the JDBC driver when establishing new connections.
 java.lang.Object getDataSource()
          Returns a datasource, if one exists that is being used to create connections.
 java.lang.String getDataSourceJNDI()
          Returns the JNDI string configured for data source usage.
 java.util.Properties getDbProperties()
          Returns the database properties that are passed into the Driver.connect(String, Properties) method.
 java.lang.Boolean getDefaultAutoCommit()
          The default auto-commit state of connections created by this pool.
 java.lang.String getDefaultCatalog()
          If non null, during connection creation the method Connection.setCatalog(String) will be called with the set value.
 java.lang.Boolean getDefaultReadOnly()
          If non null, during connection creation the method Connection.setReadOnly(boolean) will be called with the set value.
 int getDefaultTransactionIsolation()
          Returns the default transaction isolation level.
 java.lang.String getDriverClassName()
          The fully qualified Java class name of the JDBC driver to be used.
 int getInitialSize()
          Returns the number of connections that will be established when the connection pool is started.
 java.lang.String getInitSQL()
          A custom query to be run when a connection is first created.
 java.lang.String getJdbcInterceptors()
          A semicolon separated list of classnames extending JdbcInterceptor class.
 PoolProperties.InterceptorDefinition[] getJdbcInterceptorsAsArray()
          Returns the PoolConfiguration.getJdbcInterceptors() as an array of objects with properties and the classes.
 int getMaxActive()
          The maximum number of active connections that can be allocated from this pool at the same time.
 long getMaxAge()
          Time in milliseconds to keep this connection alive even when used.
 int getMaxIdle()
          The maximum number of connections that should be kept in the idle pool if PoolConfiguration.isPoolSweeperEnabled() returns false.
 int getMaxWait()
          The maximum number of milliseconds that the pool will wait (when there are no available connections and the PoolConfiguration.getMaxActive() has been reached) for a connection to be returned before throwing an exception.
 int getMinEvictableIdleTimeMillis()
          The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.
 int getMinIdle()
          The minimum number of established connections that should be kept in the pool at all times.
 java.lang.String getName()
          Returns the name of the connection pool.
 int getNumTestsPerEvictionRun()
          Property not used
 java.lang.String getPassword()
          Returns the password used when establishing connections to the database.
static int getPoolCounter()
           
 java.lang.String getPoolName()
          
static java.util.Properties getProperties(java.lang.String propText, java.util.Properties props)
           
 int getRemoveAbandonedTimeout()
          The time in seconds before a connection can be considered abandoned.
 int getSuspectTimeout()
          Returns the time in seconds to pass before a connection is marked an abanoned suspect.
 int getTimeBetweenEvictionRunsMillis()
          The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing.
 java.lang.String getUrl()
          The URL used to connect to the database
 boolean getUseLock()
          Return true if a lock should be used when operations are performed on the connection object.
 java.lang.String getUsername()
          Returns the username used to establish the connection with
 long getValidationInterval()
          avoid excess validation, only run validation at most at this frequency - time in milliseconds.
 java.lang.String getValidationQuery()
          The SQL query that will be used to validate connections from this pool before returning them to the caller or pool.
 Validator getValidator()
          
 java.lang.String getValidatorClassName()
          Return the name of the optional validator class - may be null.
 boolean isAccessToUnderlyingConnectionAllowed()
          Property not used.
 boolean isAlternateUsernameAllowed()
          Returns true if the call getConnection(username,password) is allowed.
 java.lang.Boolean isDefaultAutoCommit()
          The default auto-commit state of connections created by this pool.
 java.lang.Boolean isDefaultReadOnly()
          If non null, during connection creation the method Connection.setReadOnly(boolean) will be called with the set value.
 boolean isFairQueue()
          Returns true if a fair queue is being used by the connection pool
 boolean isJmxEnabled()
          If set to true, the connection pool creates a ConnectionPoolMBean object that can be registered with JMX to receive notifications and state about the pool.
 boolean isLogAbandoned()
          boolean flag to set if stack traces should be logged for application code which abandoned a Connection.
 boolean isPoolSweeperEnabled()
          Returns true if the pool sweeper is enabled for the connection pool.
 boolean isRemoveAbandoned()
          boolean flag to remove abandoned connections if they exceed the removeAbandonedTimout.
 boolean isTestOnBorrow()
          The indication of whether objects will be validated before being borrowed from the pool.
 boolean isTestOnConnect()
          Returns true if we should run the validation query when connecting to the database for the first time on a connection.
 boolean isTestOnReturn()
          The indication of whether objects will be validated after being returned to the pool.
 boolean isTestWhileIdle()
          Set to true if query validation should take place while the connection is idle.
 boolean isUseEquals()
          Set to true if you wish the ProxyConnection class to use String.equals instead of == when comparing method names.
 void setAbandonWhenPercentageFull(int percentage)
          Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are above the percentage defined by abandonWhenPercentageFull.
 void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed)
          No-op
 void setAlternateUsernameAllowed(boolean alternateUsernameAllowed)
          Set to true if the call getConnection(username,password) is allowed and honored..
 void setConnectionProperties(java.lang.String connectionProperties)
          The properties that will be passed into Driver.connect(String, Properties) method.
 void setDataSource(java.lang.Object ds)
          Injects a datasource that will be used to retrieve/create connections.
 void setDataSourceJNDI(java.lang.String jndiDS)
          Configure the connection pool to use a DataSource according to PoolConfiguration.setDataSource(Object) But instead of injecting the object, specify the JNDI location.
 void setDbProperties(java.util.Properties dbProperties)
          Overrides the database properties passed into the Driver.connect(String, Properties) method.
 void setDefaultAutoCommit(java.lang.Boolean defaultAutoCommit)
          The default auto-commit state of connections created by this pool.
 void setDefaultCatalog(java.lang.String defaultCatalog)
          If non null, during connection creation the method Connection.setCatalog(String) will be called with the set value.
 void setDefaultReadOnly(java.lang.Boolean defaultReadOnly)
          If non null, during connection creation the method Connection.setReadOnly(boolean) will be called with the set value.
 void setDefaultTransactionIsolation(int defaultTransactionIsolation)
          If set to DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION the method Connection.setTransactionIsolation(int) will not be called during connection creation.
 void setDriverClassName(java.lang.String driverClassName)
          The fully qualified Java class name of the JDBC driver to be used.
 void setFairQueue(boolean fairQueue)
          Set to true if you wish that calls to getConnection should be treated fairly in a true FIFO fashion.
 void setInitialSize(int initialSize)
          Set the number of connections that will be established when the connection pool is started.
 void setInitSQL(java.lang.String initSQL)
          A custom query to be run when a connection is first created.
 void setJdbcInterceptors(java.lang.String jdbcInterceptors)
          A semicolon separated list of classnames extending JdbcInterceptor class.
 void setJmxEnabled(boolean jmxEnabled)
          If set to true, the connection pool creates a ConnectionPoolMBean object that can be registered with JMX to receive notifications and state about the pool.
 void setLogAbandoned(boolean logAbandoned)
          boolean flag to set if stack traces should be logged for application code which abandoned a Connection.
 void setMaxActive(int maxActive)
          The maximum number of active connections that can be allocated from this pool at the same time.
 void setMaxAge(long maxAge)
          Time in milliseconds to keep this connection alive even when used.
 void setMaxIdle(int maxIdle)
          The maximum number of connections that should be kept in the idle pool if PoolConfiguration.isPoolSweeperEnabled() returns false.
 void setMaxWait(int maxWait)
          The maximum number of milliseconds that the pool will wait (when there are no available connections and the PoolConfiguration.getMaxActive() has been reached) for a connection to be returned before throwing an exception.
 void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
          The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.
 void setMinIdle(int minIdle)
          The minimum number of established connections that should be kept in the pool at all times.
 void setName(java.lang.String name)
          Sets the name of the connection pool
 void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
          Property not used
 void setPassword(java.lang.String password)
          Sets the password to establish the connection with.
 void setRemoveAbandoned(boolean removeAbandoned)
          boolean flag to remove abandoned connections if they exceed the removeAbandonedTimout.
 void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
          The time in seconds before a connection can be considered abandoned.
 void setSuspectTimeout(int seconds)
          Similar to PoolConfiguration.setRemoveAbandonedTimeout(int) but instead of treating the connection as abandoned, and potentially closing the connection, this simply logs the warning if PoolConfiguration.isLogAbandoned() returns true.
 void setTestOnBorrow(boolean testOnBorrow)
          The indication of whether objects will be validated before being borrowed from the pool.
 void setTestOnConnect(boolean testOnConnect)
          Set to true if we should run the validation query when connecting to the database for the first time on a connection.
 void setTestOnReturn(boolean testOnReturn)
          The indication of whether objects will be validated after being returned to the pool.
 void setTestWhileIdle(boolean testWhileIdle)
          Set to true if query validation should take place while the connection is idle.
 void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
          The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing.
 void setUrl(java.lang.String url)
          Sets the URL used to connect to the database
 void setUseEquals(boolean useEquals)
          Set to true if you wish the ProxyConnection class to use String.equals instead of == when comparing method names.
 void setUseLock(boolean useLock)
          Set to true if a lock should be used when operations are performed on the connection object.
 void setUsername(java.lang.String username)
          Sets the username used to establish the connection with It will also be a property called 'user' in the database properties.
 void setValidationInterval(long validationInterval)
          avoid excess validation, only run validation at most at this frequency - time in milliseconds.
 void setValidationQuery(java.lang.String validationQuery)
          The SQL query that will be used to validate connections from this pool before returning them to the caller or pool.
 void setValidator(Validator validator)
          Sets the validator object If this is a non null object, it will be used as a validator instead of the validationQuery If this is null, remove the usage of the validator.
 void setValidatorClassName(java.lang.String className)
          Set the name for an optional validator class which will be used in place of test queries.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_MAX_ACTIVE

public static final int DEFAULT_MAX_ACTIVE
See Also:
Constant Field Values

poolCounter

protected static java.util.concurrent.atomic.AtomicInteger poolCounter

dbProperties

protected java.util.Properties dbProperties

url

protected java.lang.String url

driverClassName

protected java.lang.String driverClassName

defaultAutoCommit

protected java.lang.Boolean defaultAutoCommit

defaultReadOnly

protected java.lang.Boolean defaultReadOnly

defaultTransactionIsolation

protected int defaultTransactionIsolation

defaultCatalog

protected java.lang.String defaultCatalog

connectionProperties

protected java.lang.String connectionProperties

initialSize

protected int initialSize

maxActive

protected int maxActive

maxIdle

protected int maxIdle

minIdle

protected int minIdle

maxWait

protected int maxWait

validationQuery

protected java.lang.String validationQuery

validatorClassName

protected java.lang.String validatorClassName

validator

protected Validator validator

testOnBorrow

protected boolean testOnBorrow

testOnReturn

protected boolean testOnReturn

testWhileIdle

protected boolean testWhileIdle

timeBetweenEvictionRunsMillis

protected int timeBetweenEvictionRunsMillis

numTestsPerEvictionRun

protected int numTestsPerEvictionRun

minEvictableIdleTimeMillis

protected int minEvictableIdleTimeMillis

accessToUnderlyingConnectionAllowed

protected final boolean accessToUnderlyingConnectionAllowed
See Also:
Constant Field Values

removeAbandoned

protected boolean removeAbandoned

removeAbandonedTimeout

protected int removeAbandonedTimeout

logAbandoned

protected boolean logAbandoned

name

protected java.lang.String name

password

protected java.lang.String password

username

protected java.lang.String username

validationInterval

protected long validationInterval

jmxEnabled

protected boolean jmxEnabled

initSQL

protected java.lang.String initSQL

testOnConnect

protected boolean testOnConnect

jdbcInterceptors

protected java.lang.String jdbcInterceptors

fairQueue

protected boolean fairQueue

useEquals

protected boolean useEquals

abandonWhenPercentageFull

protected int abandonWhenPercentageFull

maxAge

protected long maxAge

useLock

protected boolean useLock

interceptors

protected PoolProperties.InterceptorDefinition[] interceptors

suspectTimeout

protected int suspectTimeout

dataSource

protected java.lang.Object dataSource

dataSourceJNDI

protected java.lang.String dataSourceJNDI

alternateUsernameAllowed

protected boolean alternateUsernameAllowed
Constructor Detail

PoolProperties

public PoolProperties()
Method Detail

setAbandonWhenPercentageFull

public void setAbandonWhenPercentageFull(int percentage)
Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are above the percentage defined by abandonWhenPercentageFull. The value should be between 0-100. The default value is 0, which implies that connections are eligible for closure as soon as removeAbandonedTimeout has been reached.

Specified by:
setAbandonWhenPercentageFull in interface PoolConfiguration
Parameters:
percentage - a value between 0 and 100 to indicate when connections that have been abandoned/timed out are considered abandoned

getAbandonWhenPercentageFull

public int getAbandonWhenPercentageFull()
Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are above the percentage defined by abandonWhenPercentageFull. The value should be between 0-100. The default value is 0, which implies that connections are eligible for closure as soon as removeAbandonedTimeout has been reached.

Specified by:
getAbandonWhenPercentageFull in interface PoolConfiguration
Returns:
percentage - a value between 0 and 100 to indicate when connections that have been abandoned/timed out are considered abandoned

isFairQueue

public boolean isFairQueue()
Returns true if a fair queue is being used by the connection pool

Specified by:
isFairQueue in interface PoolConfiguration
Returns:
true if a fair waiting queue is being used

setFairQueue

public void setFairQueue(boolean fairQueue)
Set to true if you wish that calls to getConnection should be treated fairly in a true FIFO fashion. This uses the FairBlockingQueue implementation for the list of the idle connections. The default value is true. This flag is required when you want to use asynchronous connection retrieval.

Specified by:
setFairQueue in interface PoolConfiguration

isAccessToUnderlyingConnectionAllowed

public boolean isAccessToUnderlyingConnectionAllowed()
Property not used. Access is always allowed. Access can be achieved by calling unwrap on the pooled connection. see DataSource interface or call getConnection through reflection or cast the object as PooledConnection

Specified by:
isAccessToUnderlyingConnectionAllowed in interface PoolConfiguration
Returns:
true

getConnectionProperties

public java.lang.String getConnectionProperties()
The connection properties that will be sent to the JDBC driver when establishing new connections. Format of the string is [propertyName=property;]
NOTE - The "user" and "password" properties will be passed explicitly, so they do not need to be included here. The default value is null.

Specified by:
getConnectionProperties in interface PoolConfiguration

getDbProperties

public java.util.Properties getDbProperties()
Returns the database properties that are passed into the Driver.connect(String, Properties) method.

Specified by:
getDbProperties in interface PoolConfiguration
Returns:
database properties that are passed into the Driver.connect(String, Properties) method.

isDefaultAutoCommit

public java.lang.Boolean isDefaultAutoCommit()
The default auto-commit state of connections created by this pool. If not set (null), default is JDBC driver default (If set to null then the Connection.setAutoCommit(boolean) method will not be called.)

Specified by:
isDefaultAutoCommit in interface PoolConfiguration
Returns:
the default auto commit setting, null is Driver default.

getDefaultCatalog

public java.lang.String getDefaultCatalog()
If non null, during connection creation the method Connection.setCatalog(String) will be called with the set value.

Specified by:
getDefaultCatalog in interface PoolConfiguration
Returns:
the default catalog, null if not set and accepting the driver default.

isDefaultReadOnly

public java.lang.Boolean isDefaultReadOnly()
If non null, during connection creation the method Connection.setReadOnly(boolean) will be called with the set value.

Specified by:
isDefaultReadOnly in interface PoolConfiguration
Returns:
null if not set and accepting the driver default otherwise the read only value

getDefaultTransactionIsolation

public int getDefaultTransactionIsolation()
Returns the default transaction isolation level. If set to DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION the method Connection.setTransactionIsolation(int) will not be called during connection creation.

Specified by:
getDefaultTransactionIsolation in interface PoolConfiguration
Returns:
driver transaction isolation level, or -1 DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION if not set.

getDriverClassName

public java.lang.String getDriverClassName()
The fully qualified Java class name of the JDBC driver to be used. The driver has to be accessible from the same classloader as tomcat-jdbc.jar

Specified by:
getDriverClassName in interface PoolConfiguration
Returns:
fully qualified JDBC driver name.

getInitialSize

public int getInitialSize()
Returns the number of connections that will be established when the connection pool is started. Default value is 10

Specified by:
getInitialSize in interface PoolConfiguration
Returns:
number of connections to be started when pool is started

isLogAbandoned

public boolean isLogAbandoned()
boolean flag to set if stack traces should be logged for application code which abandoned a Connection. Logging of abandoned Connections adds overhead for every Connection borrow because a stack trace has to be generated. The default value is false.

Specified by:
isLogAbandoned in interface PoolConfiguration
Returns:
true if the connection pool logs stack traces when connections are borrowed from the pool.

getMaxActive

public int getMaxActive()
The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100

Specified by:
getMaxActive in interface PoolConfiguration
Returns:
the maximum number of connections used by this pool

getMaxIdle

public int getMaxIdle()
The maximum number of connections that should be kept in the idle pool if PoolConfiguration.isPoolSweeperEnabled() returns false. If the If PoolConfiguration.isPoolSweeperEnabled() returns true, then the idle pool can grow up to PoolConfiguration.getMaxActive() and will be shrunk according to PoolConfiguration.getMinEvictableIdleTimeMillis() setting. Default value is maxActive:100

Specified by:
getMaxIdle in interface PoolConfiguration
Returns:
the maximum number of idle connections.

getMaxWait

public int getMaxWait()
The maximum number of milliseconds that the pool will wait (when there are no available connections and the PoolConfiguration.getMaxActive() has been reached) for a connection to be returned before throwing an exception. Default value is 30000 (30 seconds)

Specified by:
getMaxWait in interface PoolConfiguration
Returns:
the number of milliseconds to wait for a connection to become available if the pool is maxed out.

getMinEvictableIdleTimeMillis

public int getMinEvictableIdleTimeMillis()
The minimum amount of time an object must sit idle in the pool before it is eligible for eviction. The default value is 60000 (60 seconds).

Specified by:
getMinEvictableIdleTimeMillis in interface PoolConfiguration
Returns:
the minimum amount of idle time in milliseconds before a connection is considered idle and eligible for eviction.

getMinIdle

public int getMinIdle()
The minimum number of established connections that should be kept in the pool at all times. The connection pool can shrink below this number if validation queries fail and connections get closed. Default value is derived from PoolConfiguration.getInitialSize() (also see PoolConfiguration.setTestWhileIdle(boolean) The idle pool will not shrink below this value during an eviction run, hence the number of actual connections can be between PoolConfiguration.getMinIdle() and somewhere between PoolConfiguration.getMaxIdle() and PoolConfiguration.getMaxActive()

Specified by:
getMinIdle in interface PoolConfiguration
Returns:
the minimum number of idle or established connections

getName

public java.lang.String getName()
Returns the name of the connection pool. By default a JVM unique random name is assigned.

Specified by:
getName in interface PoolConfiguration
Returns:
the name of the pool, should be unique in a JVM

getNumTestsPerEvictionRun

public int getNumTestsPerEvictionRun()
Property not used

Specified by:
getNumTestsPerEvictionRun in interface PoolConfiguration
Returns:
unknown value

getPassword

public java.lang.String getPassword()
Returns the password used when establishing connections to the database.

Specified by:
getPassword in interface PoolConfiguration
Returns:
the password in string format

getPoolName

public java.lang.String getPoolName()

Specified by:
getPoolName in interface PoolConfiguration
Returns:
name
See Also:
PoolConfiguration.getName()

isRemoveAbandoned

public boolean isRemoveAbandoned()
boolean flag to remove abandoned connections if they exceed the removeAbandonedTimout. If set to true a connection is considered abandoned and eligible for removal if it has been in use longer than the PoolConfiguration.getRemoveAbandonedTimeout() and the condition for PoolConfiguration.getAbandonWhenPercentageFull() is met. Setting this to true can recover db connections from applications that fail to close a connection. See also PoolConfiguration.isLogAbandoned() The default value is false.

Specified by:
isRemoveAbandoned in interface PoolConfiguration
Returns:
true if abandoned connections can be closed and expelled out of the pool

getRemoveAbandonedTimeout

public int getRemoveAbandonedTimeout()
The time in seconds before a connection can be considered abandoned. The timer can be reset upon queries using an interceptor.

Specified by:
getRemoveAbandonedTimeout in interface PoolConfiguration
Returns:
the time in seconds before a used connection can be considered abandoned
See Also:
ResetAbandonedTimer

isTestOnBorrow

public boolean isTestOnBorrow()
The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. NOTE - for a true value to have any effect, the validationQuery parameter must be set to a non-null string. Default value is false In order to have a more efficient validation, see PoolConfiguration.setValidationInterval(long)

Specified by:
isTestOnBorrow in interface PoolConfiguration
Returns:
true if the connection is to be validated upon borrowing a connection from the pool
See Also:
PoolConfiguration.getValidationInterval()

isTestOnReturn

public boolean isTestOnReturn()
The indication of whether objects will be validated after being returned to the pool. If the object fails to validate, it will be dropped from the pool. NOTE - for a true value to have any effect, the validationQuery parameter must be set to a non-null string. Default value is false In order to have a more efficient validation, see PoolConfiguration.setValidationInterval(long)

Specified by:
isTestOnReturn in interface PoolConfiguration
Returns:
true if validation should take place after a connection is returned to the pool
See Also:
PoolConfiguration.getValidationInterval()

isTestWhileIdle

public boolean isTestWhileIdle()
Set to true if query validation should take place while the connection is idle.

Specified by:
isTestWhileIdle in interface PoolConfiguration
Returns:
true if validation should take place during idle checks
See Also:
PoolConfiguration.setTimeBetweenEvictionRunsMillis(int)

getTimeBetweenEvictionRunsMillis

public int getTimeBetweenEvictionRunsMillis()
The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing. This value should not be set under 1 second. It dictates how often we check for idle, abandoned connections, and how often we validate idle connection and resize the idle pool. The default value is 5000 (5 seconds)

Specified by:
getTimeBetweenEvictionRunsMillis in interface PoolConfiguration
Returns:
the sleep time in between validations in milliseconds

getUrl

public java.lang.String getUrl()
The URL used to connect to the database

Specified by:
getUrl in interface PoolConfiguration
Returns:
the configured URL for this connection pool
See Also:
Driver.connect(String, Properties)

getUsername

public java.lang.String getUsername()
Returns the username used to establish the connection with

Specified by:
getUsername in interface PoolConfiguration
Returns:
the username used to establish the connection with

getValidationQuery

public java.lang.String getValidationQuery()
The SQL query that will be used to validate connections from this pool before returning them to the caller or pool. If specified, this query does not have to return any data, it just can't throw a SQLException. The default value is null. Example values are SELECT 1(mysql), select 1 from dual(oracle), SELECT 1(MS Sql Server)

Specified by:
getValidationQuery in interface PoolConfiguration
Returns:
the query used for validation or null if no validation is performed

getValidatorClassName

public java.lang.String getValidatorClassName()
Return the name of the optional validator class - may be null.

Specified by:
getValidatorClassName in interface PoolConfiguration
Returns:
the name of the optional validator class - may be null

getValidator

public Validator getValidator()

Specified by:
getValidator in interface PoolConfiguration
Returns:
the optional validator object - may be null

setValidator

public void setValidator(Validator validator)
Sets the validator object If this is a non null object, it will be used as a validator instead of the validationQuery If this is null, remove the usage of the validator.

Specified by:
setValidator in interface PoolConfiguration

getValidationInterval

public long getValidationInterval()
avoid excess validation, only run validation at most at this frequency - time in milliseconds. If a connection is due for validation, but has been validated previously within this interval, it will not be validated again. The default value is 30000 (30 seconds).

Specified by:
getValidationInterval in interface PoolConfiguration
Returns:
the validation interval in milliseconds

getInitSQL

public java.lang.String getInitSQL()
A custom query to be run when a connection is first created. The default value is null. This query only runs once per connection, and that is when a new connection is established to the database. If this value is non null, it will replace the validation query during connection creation.

Specified by:
getInitSQL in interface PoolConfiguration
Returns:
the init SQL used to run against the DB or null if not set

isTestOnConnect

public boolean isTestOnConnect()
Returns true if we should run the validation query when connecting to the database for the first time on a connection. Normally this is always set to false, unless one wants to use the validationQuery as an init query.

Specified by:
isTestOnConnect in interface PoolConfiguration
Returns:
true if we should run the validation query upon connect

getJdbcInterceptors

public java.lang.String getJdbcInterceptors()
A semicolon separated list of classnames extending JdbcInterceptor class. These interceptors will be inserted as an interceptor into the chain of operations on a java.sql.Connection object. Example interceptors are StatementFinalizer to close all used statements during the session. ResetAbandonedTimer resets the timer upon every operation on the connection or a statement. ConnectionState caches the auto commit, read only and catalog settings to avoid round trips to the DB. The default value is null.

Specified by:
getJdbcInterceptors in interface PoolConfiguration
Returns:
the interceptors that are used for connections. Example format: 'ConnectionState(useEquals=true,fast=yes);ResetAbandonedTimer'

getJdbcInterceptorsAsArray

public PoolProperties.InterceptorDefinition[] getJdbcInterceptorsAsArray()
Returns the PoolConfiguration.getJdbcInterceptors() as an array of objects with properties and the classes.

Specified by:
getJdbcInterceptorsAsArray in interface PoolConfiguration
Returns:
an array of interceptors that have been configured

setAccessToUnderlyingConnectionAllowed

public void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed)
No-op

Specified by:
setAccessToUnderlyingConnectionAllowed in interface PoolConfiguration
Parameters:
accessToUnderlyingConnectionAllowed - parameter ignored

setConnectionProperties

public void setConnectionProperties(java.lang.String connectionProperties)
The properties that will be passed into Driver.connect(String, Properties) method. Username and password do not need to be stored here, they will be passed into the properties right before the connection is established.

Specified by:
setConnectionProperties in interface PoolConfiguration
Parameters:
connectionProperties - properties - Format of the string is [propertyName=property;]* Example: prop1=value1;prop2=value2

setDbProperties

public void setDbProperties(java.util.Properties dbProperties)
Overrides the database properties passed into the Driver.connect(String, Properties) method.

Specified by:
setDbProperties in interface PoolConfiguration

setDefaultAutoCommit

public void setDefaultAutoCommit(java.lang.Boolean defaultAutoCommit)
The default auto-commit state of connections created by this pool. If not set (null), default is JDBC driver default (If set to null then the Connection.setAutoCommit(boolean) method will not be called.)

Specified by:
setDefaultAutoCommit in interface PoolConfiguration
Parameters:
defaultAutoCommit - default auto commit setting, null is Driver default.

setDefaultCatalog

public void setDefaultCatalog(java.lang.String defaultCatalog)
If non null, during connection creation the method Connection.setCatalog(String) will be called with the set value.

Specified by:
setDefaultCatalog in interface PoolConfiguration
Parameters:
defaultCatalog - null if not set and accepting the driver default.

setDefaultReadOnly

public void setDefaultReadOnly(java.lang.Boolean defaultReadOnly)
If non null, during connection creation the method Connection.setReadOnly(boolean) will be called with the set value.

Specified by:
setDefaultReadOnly in interface PoolConfiguration
Parameters:
defaultReadOnly - null if not set and accepting the driver default.

setDefaultTransactionIsolation

public void setDefaultTransactionIsolation(int defaultTransactionIsolation)
If set to DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION the method Connection.setTransactionIsolation(int) will not be called during connection creation. Otherwise the method will be called with the isolation level set by this property.

Specified by:
setDefaultTransactionIsolation in interface PoolConfiguration
Parameters:
defaultTransactionIsolation - a value of Connection.TRANSACTION_NONE, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_REPEATABLE_READ, Connection.TRANSACTION_SERIALIZABLE or DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION The last value will not be set on the connection.

setDriverClassName

public void setDriverClassName(java.lang.String driverClassName)
The fully qualified Java class name of the JDBC driver to be used. The driver has to be accessible from the same classloader as tomcat-jdbc.jar

Specified by:
setDriverClassName in interface PoolConfiguration
Parameters:
driverClassName - a fully qualified Java class name of a Driver implementation.

setInitialSize

public void setInitialSize(int initialSize)
Set the number of connections that will be established when the connection pool is started. Default value is 10. If this value exceeds PoolConfiguration.setMaxActive(int) it will automatically be lowered.

Specified by:
setInitialSize in interface PoolConfiguration
Parameters:
initialSize - the number of connections to be established.

setLogAbandoned

public void setLogAbandoned(boolean logAbandoned)
boolean flag to set if stack traces should be logged for application code which abandoned a Connection. Logging of abandoned Connections adds overhead for every Connection borrow because a stack trace has to be generated. The default value is false.

Specified by:
setLogAbandoned in interface PoolConfiguration
Parameters:
logAbandoned - set to true if stack traces should be recorded when DataSourceProxy.getConnection() is called.

setMaxActive

public void setMaxActive(int maxActive)
The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100

Specified by:
setMaxActive in interface PoolConfiguration
Parameters:
maxActive - hard limit for number of managed connections by this pool

setMaxIdle

public void setMaxIdle(int maxIdle)
The maximum number of connections that should be kept in the idle pool if PoolConfiguration.isPoolSweeperEnabled() returns false. If the If PoolConfiguration.isPoolSweeperEnabled() returns true, then the idle pool can grow up to PoolConfiguration.getMaxActive() and will be shrunk according to PoolConfiguration.getMinEvictableIdleTimeMillis() setting. Default value is maxActive:100

Specified by:
setMaxIdle in interface PoolConfiguration
Parameters:
maxIdle - the maximum size of the idle pool

setMaxWait

public void setMaxWait(int maxWait)
The maximum number of milliseconds that the pool will wait (when there are no available connections and the PoolConfiguration.getMaxActive() has been reached) for a connection to be returned before throwing an exception. Default value is 30000 (30 seconds)

Specified by:
setMaxWait in interface PoolConfiguration
Parameters:
maxWait - the maximum number of milliseconds to wait.

setMinEvictableIdleTimeMillis

public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
The minimum amount of time an object must sit idle in the pool before it is eligible for eviction. The default value is 60000 (60 seconds).

Specified by:
setMinEvictableIdleTimeMillis in interface PoolConfiguration
Parameters:
minEvictableIdleTimeMillis - the number of milliseconds a connection must be idle to be eligible for eviction.

setMinIdle

public void setMinIdle(int minIdle)
The minimum number of established connections that should be kept in the pool at all times. The connection pool can shrink below this number if validation queries fail and connections get closed. Default value is derived from PoolConfiguration.getInitialSize() (also see PoolConfiguration.setTestWhileIdle(boolean) The idle pool will not shrink below this value during an eviction run, hence the number of actual connections can be between PoolConfiguration.getMinIdle() and somewhere between PoolConfiguration.getMaxIdle() and PoolConfiguration.getMaxActive()

Specified by:
setMinIdle in interface PoolConfiguration
Parameters:
minIdle - the minimum number of idle or established connections

setName

public void setName(java.lang.String name)
Sets the name of the connection pool

Specified by:
setName in interface PoolConfiguration
Parameters:
name - the name of the pool, should be unique in a runtime JVM

setNumTestsPerEvictionRun

public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
Property not used

Specified by:
setNumTestsPerEvictionRun in interface PoolConfiguration
Parameters:
numTestsPerEvictionRun - parameter ignored.

setPassword

public void setPassword(java.lang.String password)
Sets the password to establish the connection with. The password will be included as a database property with the name 'password'.

Specified by:
setPassword in interface PoolConfiguration
See Also:
PoolConfiguration.getDbProperties()

setRemoveAbandoned

public void setRemoveAbandoned(boolean removeAbandoned)
boolean flag to remove abandoned connections if they exceed the removeAbandonedTimout. If set to true a connection is considered abandoned and eligible for removal if it has been in use longer than the PoolConfiguration.getRemoveAbandonedTimeout() and the condition for PoolConfiguration.getAbandonWhenPercentageFull() is met. Setting this to true can recover db connections from applications that fail to close a connection. See also PoolConfiguration.isLogAbandoned() The default value is false.

Specified by:
setRemoveAbandoned in interface PoolConfiguration
Parameters:
removeAbandoned - set to true if abandoned connections can be closed and expelled out of the pool

setRemoveAbandonedTimeout

public void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
The time in seconds before a connection can be considered abandoned. The timer can be reset upon queries using an interceptor.

Specified by:
setRemoveAbandonedTimeout in interface PoolConfiguration
Parameters:
removeAbandonedTimeout - the time in seconds before a used connection can be considered abandoned
See Also:
ResetAbandonedTimer

setTestOnBorrow

public void setTestOnBorrow(boolean testOnBorrow)
The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. NOTE - for a true value to have any effect, the validationQuery parameter must be set to a non-null string. Default value is false In order to have a more efficient validation, see PoolConfiguration.setValidationInterval(long)

Specified by:
setTestOnBorrow in interface PoolConfiguration
Parameters:
testOnBorrow - set to true if validation should take place before a connection is handed out to the application
See Also:
PoolConfiguration.getValidationInterval()

setTestWhileIdle

public void setTestWhileIdle(boolean testWhileIdle)
Set to true if query validation should take place while the connection is idle.

Specified by:
setTestWhileIdle in interface PoolConfiguration
Parameters:
testWhileIdle - true if validation should take place during idle checks
See Also:
PoolConfiguration.setTimeBetweenEvictionRunsMillis(int)

setTestOnReturn

public void setTestOnReturn(boolean testOnReturn)
The indication of whether objects will be validated after being returned to the pool. If the object fails to validate, it will be dropped from the pool. NOTE - for a true value to have any effect, the validationQuery parameter must be set to a non-null string. Default value is false In order to have a more efficient validation, see PoolConfiguration.setValidationInterval(long)

Specified by:
setTestOnReturn in interface PoolConfiguration
Parameters:
testOnReturn - true if validation should take place after a connection is returned to the pool
See Also:
PoolConfiguration.getValidationInterval()

setTimeBetweenEvictionRunsMillis

public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing. This value should not be set under 1 second. It dictates how often we check for idle, abandoned connections, and how often we validate idle connection and resize the idle pool. The default value is 5000 (5 seconds)

Specified by:
setTimeBetweenEvictionRunsMillis in interface PoolConfiguration
Parameters:
timeBetweenEvictionRunsMillis - the sleep time in between validations in milliseconds

setUrl

public void setUrl(java.lang.String url)
Sets the URL used to connect to the database

Specified by:
setUrl in interface PoolConfiguration
Parameters:
url - the configured URL for this connection pool
See Also:
Driver.connect(String, Properties)

setUsername

public void setUsername(java.lang.String username)
Sets the username used to establish the connection with It will also be a property called 'user' in the database properties.

Specified by:
setUsername in interface PoolConfiguration
See Also:
PoolConfiguration.getDbProperties()

setValidationInterval

public void setValidationInterval(long validationInterval)
avoid excess validation, only run validation at most at this frequency - time in milliseconds. If a connection is due for validation, but has been validated previously within this interval, it will not be validated again. The default value is 30000 (30 seconds).

Specified by:
setValidationInterval in interface PoolConfiguration
Parameters:
validationInterval - the validation interval in milliseconds

setValidationQuery

public void setValidationQuery(java.lang.String validationQuery)
The SQL query that will be used to validate connections from this pool before returning them to the caller or pool. If specified, this query does not have to return any data, it just can't throw a SQLException. The default value is null. Example values are SELECT 1(mysql), select 1 from dual(oracle), SELECT 1(MS Sql Server)

Specified by:
setValidationQuery in interface PoolConfiguration
Parameters:
validationQuery - the query used for validation or null if no validation is performed

setValidatorClassName

public void setValidatorClassName(java.lang.String className)
Set the name for an optional validator class which will be used in place of test queries. If set to null, standard validation will be used.

Specified by:
setValidatorClassName in interface PoolConfiguration
Parameters:
className - the name of the optional validator class

setInitSQL

public void setInitSQL(java.lang.String initSQL)
A custom query to be run when a connection is first created. The default value is null. This query only runs once per connection, and that is when a new connection is established to the database. If this value is non null, it will replace the validation query during connection creation.

Specified by:
setInitSQL in interface PoolConfiguration
Parameters:
initSQL - the init SQL used to run against the DB or null if no query should be executed

setTestOnConnect

public void setTestOnConnect(boolean testOnConnect)
Set to true if we should run the validation query when connecting to the database for the first time on a connection. Normally this is always set to false, unless one wants to use the validationQuery as an init query. Setting an PoolConfiguration.setInitSQL(String) will override this setting, as the init SQL will be used instead of the validation query

Specified by:
setTestOnConnect in interface PoolConfiguration
Parameters:
testOnConnect - set to true if we should run the validation query upon connect

setJdbcInterceptors

public void setJdbcInterceptors(java.lang.String jdbcInterceptors)
A semicolon separated list of classnames extending JdbcInterceptor class. These interceptors will be inserted as an interceptor into the chain of operations on a java.sql.Connection object. Example interceptors are StatementFinalizer to close all used statements during the session. ResetAbandonedTimer resets the timer upon every operation on the connection or a statement. ConnectionState caches the auto commit, read only and catalog settings to avoid round trips to the DB. The default value is null.

Specified by:
setJdbcInterceptors in interface PoolConfiguration
Parameters:
jdbcInterceptors - the interceptors that are used for connections. Example format: 'ConnectionState(useEquals=true,fast=yes);ResetAbandonedTimer'

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPoolCounter

public static int getPoolCounter()

isJmxEnabled

public boolean isJmxEnabled()
If set to true, the connection pool creates a ConnectionPoolMBean object that can be registered with JMX to receive notifications and state about the pool. The ConnectionPool object doesn't register itself, as there is no way to keep a static non changing ObjectName across JVM restarts.

Specified by:
isJmxEnabled in interface PoolConfiguration
Returns:
true if the mbean object will be created upon startup.

setJmxEnabled

public void setJmxEnabled(boolean jmxEnabled)
If set to true, the connection pool creates a ConnectionPoolMBean object that can be registered with JMX to receive notifications and state about the pool. The ConnectionPool object doesn't register itself, as there is no way to keep a static non changing ObjectName across JVM restarts.

Specified by:
setJmxEnabled in interface PoolConfiguration
Parameters:
jmxEnabled - set to to if the mbean object should be created upon startup.

getDefaultAutoCommit

public java.lang.Boolean getDefaultAutoCommit()
The default auto-commit state of connections created by this pool. If not set (null), default is JDBC driver default (If set to null then the Connection.setAutoCommit(boolean) method will not be called.)

Specified by:
getDefaultAutoCommit in interface PoolConfiguration
Returns:
the default auto commit setting, null is Driver default.

getDefaultReadOnly

public java.lang.Boolean getDefaultReadOnly()
If non null, during connection creation the method Connection.setReadOnly(boolean) will be called with the set value.

Specified by:
getDefaultReadOnly in interface PoolConfiguration
Returns:
null if not set and accepting the driver default otherwise the read only value

getSuspectTimeout

public int getSuspectTimeout()
Returns the time in seconds to pass before a connection is marked an abanoned suspect. Any value lesser than or equal to 0 means the check is disabled.

Specified by:
getSuspectTimeout in interface PoolConfiguration
Returns:
Returns the time in seconds to pass before a connection is marked an abanoned suspect.

setSuspectTimeout

public void setSuspectTimeout(int seconds)
Similar to PoolConfiguration.setRemoveAbandonedTimeout(int) but instead of treating the connection as abandoned, and potentially closing the connection, this simply logs the warning if PoolConfiguration.isLogAbandoned() returns true. If this value is equal or less than 0, no suspect checking will be performed. Suspect checking only takes place if the timeout value is larger than 0 and the connection was not abandoned or if abandon check is disabled. If a connection is suspect a WARN message gets logged and a JMX notification gets sent once.

Specified by:
setSuspectTimeout in interface PoolConfiguration
Parameters:
seconds - - the amount of time in seconds that has to pass before a connection is marked suspect.

isPoolSweeperEnabled

public boolean isPoolSweeperEnabled()
Returns true if the pool sweeper is enabled for the connection pool. The pool sweeper is enabled if any settings that require async intervention in the pool are turned on boolean result = getTimeBetweenEvictionRunsMillis()>0; result = result && (isRemoveAbandoned() && getRemoveAbandonedTimeout()>0); result = result || (isTestWhileIdle() && getValidationQuery()!=null); return result;

Specified by:
isPoolSweeperEnabled in interface PoolConfiguration
Returns:
true if a background thread is or will be enabled for this pool

isUseEquals

public boolean isUseEquals()
Set to true if you wish the ProxyConnection class to use String.equals instead of == when comparing method names. This property does not apply to added interceptors as those are configured individually. The default value is false.

Specified by:
isUseEquals in interface PoolConfiguration
Returns:
true if pool uses String.equals(Object) instead of == when comparing method names on Connection methods

setUseEquals

public void setUseEquals(boolean useEquals)
Set to true if you wish the ProxyConnection class to use String.equals instead of == when comparing method names. This property does not apply to added interceptors as those are configured individually. The default value is false.

Specified by:
setUseEquals in interface PoolConfiguration
Parameters:
useEquals - set to true if the pool should use String.equals(Object) instead of == when comparing method names on Connection methods

getMaxAge

public long getMaxAge()
Time in milliseconds to keep this connection alive even when used. When a connection is returned to the pool, the pool will check to see if the ((now - time-when-connected) > maxAge) has been reached, and if so, it closes the connection rather than returning it to the pool. The default value is 0, which implies that connections will be left open and no age check will be done upon returning the connection to the pool. This is a useful setting for database sessions that leak memory as it ensures that the session will have a finite life span.

Specified by:
getMaxAge in interface PoolConfiguration
Returns:
the time in milliseconds a connection will be open for when used

setMaxAge

public void setMaxAge(long maxAge)
Time in milliseconds to keep this connection alive even when used. When a connection is returned to the pool, the pool will check to see if the ((now - time-when-connected) > maxAge) has been reached, and if so, it closes the connection rather than returning it to the pool. The default value is 0, which implies that connections will be left open and no age check will be done upon returning the connection to the pool. This is a useful setting for database sessions that leak memory as it ensures that the session will have a finite life span.

Specified by:
setMaxAge in interface PoolConfiguration
Parameters:
maxAge - the time in milliseconds a connection will be open for when used

getUseLock

public boolean getUseLock()
Return true if a lock should be used when operations are performed on the connection object. Should be set to false unless you plan to have a background thread of your own doing idle and abandon checking such as JMX clients. If the pool sweeper is enabled, then the lock will automatically be used regardless of this setting.

Specified by:
getUseLock in interface PoolConfiguration
Returns:
true if a lock is used.

setUseLock

public void setUseLock(boolean useLock)
Set to true if a lock should be used when operations are performed on the connection object. Should be set to false unless you plan to have a background thread of your own doing idle and abandon checking such as JMX clients. If the pool sweeper is enabled, then the lock will automatically be used regardless of this setting.

Specified by:
setUseLock in interface PoolConfiguration
Parameters:
useLock - set to true if a lock should be used on connection operations

setDataSource

public void setDataSource(java.lang.Object ds)
Injects a datasource that will be used to retrieve/create connections. If a data source is set, the PoolConfiguration.getUrl() and PoolConfiguration.getDriverClassName() methods are ignored and not used by the pool. If the PoolConfiguration.getUsername() and PoolConfiguration.getPassword() values are set, the method DataSource.getConnection(String, String) method will be called instead of the DataSource.getConnection() method. If the data source implements XADataSource the methods XADataSource.getXAConnection() and XADataSource.getXAConnection(String,String) will be invoked.

Specified by:
setDataSource in interface PoolConfiguration
Parameters:
ds - the DataSource to be used for creating connections to be pooled.

getDataSource

public java.lang.Object getDataSource()
Returns a datasource, if one exists that is being used to create connections. This method will return null if the pool is using a Driver

Specified by:
getDataSource in interface PoolConfiguration
Returns:
the DataSource to be used for creating connections to be pooled or null if a Driver is used.

setDataSourceJNDI

public void setDataSourceJNDI(java.lang.String jndiDS)
Configure the connection pool to use a DataSource according to PoolConfiguration.setDataSource(Object) But instead of injecting the object, specify the JNDI location. After a successful JNDI look, the PoolConfiguration.getDataSource() will not return null.

Specified by:
setDataSourceJNDI in interface PoolConfiguration
Parameters:
jndiDS - -the JNDI string @TODO specify the rules here.

getDataSourceJNDI

public java.lang.String getDataSourceJNDI()
Returns the JNDI string configured for data source usage.

Specified by:
getDataSourceJNDI in interface PoolConfiguration
Returns:
the JNDI string or null if not set

getProperties

public static java.util.Properties getProperties(java.lang.String propText,
                                                 java.util.Properties props)

isAlternateUsernameAllowed

public boolean isAlternateUsernameAllowed()
Returns true if the call getConnection(username,password) is allowed. This is used for when the pool is used by an application accessing multiple schemas. There is a performance impact turning this option on.

Specified by:
isAlternateUsernameAllowed in interface PoolConfiguration
Returns:
true if getConnection(username,password) is honored, false if it is ignored.

setAlternateUsernameAllowed

public void setAlternateUsernameAllowed(boolean alternateUsernameAllowed)
Set to true if the call getConnection(username,password) is allowed and honored.. This is used for when the pool is used by an application accessing multiple schemas. There is a performance impact turning this option on, even when not used due to username checks.

Specified by:
setAlternateUsernameAllowed in interface PoolConfiguration
Parameters:
alternateUsernameAllowed - - set true if getConnection(username,password) is honored, false if it is to be ignored.

Apache Tomcat 7.0.23

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.