Package org.apache.tomcat.jdbc.pool.jmx
Class ConnectionPool
- java.lang.Object
- 
- javax.management.NotificationBroadcasterSupport
- 
- org.apache.tomcat.jdbc.pool.jmx.ConnectionPool
 
 
- 
- All Implemented Interfaces:
- javax.management.MBeanRegistration,- javax.management.NotificationBroadcaster,- javax.management.NotificationEmitter,- ConnectionPoolMBean,- PoolConfiguration
 
 public class ConnectionPool extends javax.management.NotificationBroadcasterSupport implements ConnectionPoolMBean, javax.management.MBeanRegistration 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringFAILED_QUERY_NOTIFICATIONprotected java.util.concurrent.ConcurrentLinkedQueue<javax.management.NotificationListener>listenersListeners that are local and interested in our notifications, no need for JMXstatic java.lang.StringNOTIFY_ABANDONstatic java.lang.StringNOTIFY_CONNECTstatic java.lang.StringNOTIFY_INITprotected ConnectionPoolpoolthe connection poolstatic java.lang.StringPOOL_EMPTYprotected java.util.concurrent.atomic.AtomicIntegersequencesequence for JMX notificationsstatic java.lang.StringSLOW_QUERY_NOTIFICATIONstatic java.lang.StringSUSPECT_ABANDONED_NOTIFICATIONstatic java.lang.StringSUSPECT_RETURNED_NOTIFICATION- 
Fields inherited from interface org.apache.tomcat.jdbc.pool.PoolConfigurationPKG_PREFIX
 
- 
 - 
Constructor SummaryConstructors Constructor Description ConnectionPool(ConnectionPool pool)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(javax.management.NotificationListener list)voidcheckAbandoned()voidcheckIdle()intgetAbandonWhenPercentageFull()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.intgetActive()longgetBorrowedCount()booleangetCommitOnReturn()java.lang.StringgetConnectionProperties()The connection properties that will be sent to the JDBC driver when establishing new connections.longgetCreatedCount()java.lang.ObjectgetDataSource()Returns a datasource, if one exists that is being used to create connections.java.lang.StringgetDataSourceJNDI()Returns the JNDI string configured for data source usage.java.util.PropertiesgetDbProperties()Returns the database properties that are passed into theDriver.connect(String, Properties)method.java.lang.BooleangetDefaultAutoCommit()The default auto-commit state of connections created by this pool.java.lang.StringgetDefaultCatalog()If non null, during connection creation the methodConnection.setCatalog(String)will be called with the set value.static javax.management.MBeanNotificationInfo[]getDefaultNotificationInfo()java.lang.BooleangetDefaultReadOnly()If non null, during connection creation the methodConnection.setReadOnly(boolean)will be called with the set value.intgetDefaultTransactionIsolation()Returns the default transaction isolation level.java.lang.StringgetDriverClassName()The fully qualified Java class name of the JDBC driver to be used.intgetIdle()intgetInitialSize()Returns the number of connections that will be established when the connection pool is started.java.lang.StringgetInitSQL()A custom query to be run when a connection is first created.java.lang.StringgetJdbcInterceptors()A semicolon separated list of classnames extendingJdbcInterceptorclass.PoolProperties.InterceptorDefinition[]getJdbcInterceptorsAsArray()Returns thePoolConfiguration.getJdbcInterceptors()as an array of objects with properties and the classes.booleangetLogValidationErrors()Returns true if errors that happen during validation will be loggedintgetMaxActive()The maximum number of active connections that can be allocated from this pool at the same time.longgetMaxAge()Time in milliseconds to keep this connection before reconnecting.intgetMaxIdle()The maximum number of connections that should be kept in the idle pool ifPoolConfiguration.isPoolSweeperEnabled()returns false.intgetMaxWait()The maximum number of milliseconds that the pool will wait (when there are no available connections and thePoolConfiguration.getMaxActive()has been reached) for a connection to be returned before throwing an exception.intgetMinEvictableIdleTimeMillis()The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.intgetMinIdle()The minimum number of established connections that should be kept in the pool at all times.java.lang.StringgetName()Returns the name of the connection pool.javax.management.MBeanNotificationInfo[]getNotificationInfo()intgetNumActive()intgetNumIdle()intgetNumTestsPerEvictionRun()Property not usedjavax.management.ObjectNamegetObjectName()java.lang.StringgetPassword()Returns the password used when establishing connections to the database.ConnectionPoolgetPool()java.lang.StringgetPoolName()PoolConfigurationgetPoolProperties()booleangetPropagateInterruptState()Returns true if the pool is configured to propagate interrupt state of a thread.longgetReconnectedCount()longgetReleasedCount()longgetReleasedIdleCount()longgetRemoveAbandonedCount()intgetRemoveAbandonedTimeout()The time in seconds before a connection can be considered abandoned.longgetReturnedCount()booleangetRollbackOnReturn()intgetSize()intgetSuspectTimeout()Returns the time in seconds to pass before a connection is marked an abandoned suspect.intgetTimeBetweenEvictionRunsMillis()The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing.java.lang.StringgetUrl()The URL used to connect to the databasebooleangetUseDisposableConnectionFacade()Returnstrueif this connection pool is configured to use a connection facade to prevent re-use of connection afterConnection.close()has been invokedbooleangetUseLock()Return true if a lock should be used when operations are performed on the connection object.java.lang.StringgetUsername()Returns the username used to establish the connection withbooleangetUseStatementFacade()Returnstrueif this connection pool is configured to wrap statements in order to enable equals() and hashCode() methods to be called on the closed statements if any statement proxy is set.longgetValidationInterval()avoid excess validation, only run validation at most at this frequency - time in milliseconds.java.lang.StringgetValidationQuery()The SQL query that will be used to validate connections from this pool before returning them to the caller or pool.intgetValidationQueryTimeout()The timeout in seconds before a connection validation queries fail.ValidatorgetValidator()java.lang.StringgetValidatorClassName()Return the name of the optional validator class - may be null.intgetWaitCount()booleanisAccessToUnderlyingConnectionAllowed()Property not used.booleanisAlternateUsernameAllowed()Returns true if the callgetConnection(username,password)is allowed.java.lang.BooleanisDefaultAutoCommit()The default auto-commit state of connections created by this pool.java.lang.BooleanisDefaultReadOnly()If non null, during connection creation the methodConnection.setReadOnly(boolean)will be called with the set value.booleanisFairQueue()Returnstrueif a fair queue is being used by the connection poolbooleanisIgnoreExceptionOnPreLoad()booleanisJmxEnabled()If set to true, the connection pool creates aConnectionPoolMBeanobject that can be registered with JMX to receive notifications and state about the pool.booleanisLogAbandoned()boolean flag to set if stack traces should be logged for application code which abandoned a Connection.booleanisPoolSweeperEnabled()Returns true if the pool sweeper is enabled for the connection pool.booleanisRemoveAbandoned()boolean flag to remove abandoned connections if they exceed the removeAbandonedTimeout.booleanisTestOnBorrow()The indication of whether objects will be validated before being borrowed from the pool.booleanisTestOnConnect()Returns true if we should run the validation query when connecting to the database for the first time on a connection.booleanisTestOnReturn()The indication of whether objects will be validated after being returned to the pool.booleanisTestWhileIdle()Set to true if query validation should take place while the connection is idle.booleanisUseEquals()Set to true if you wish theProxyConnectionclass to useString.equalsinstead of==when comparing method names.booleannotify(java.lang.String type, java.lang.String message)Return true if the notification was sent successfully, false otherwise.voidpostDeregister()voidpostRegister(java.lang.Boolean registrationDone)voidpreDeregister()javax.management.ObjectNamepreRegister(javax.management.MBeanServer server, javax.management.ObjectName name)voidpurge()Purges all connections in the pool.voidpurgeOnReturn()Purges connections when they are returned from the pool.booleanremoveListener(javax.management.NotificationListener list)voidresetStats()reset the statistics of this pool.voidsetAbandonWhenPercentageFull(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.voidsetAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed)No-opvoidsetAlternateUsernameAllowed(boolean alternateUsernameAllowed)Set to true if the callgetConnection(username,password)is allowed and honored..voidsetCommitOnReturn(boolean commitOnReturn)Set to true if you want the connection pool to commit any pending transaction when a connection is returned.voidsetConnectionProperties(java.lang.String connectionProperties)The properties that will be passed intoDriver.connect(String, Properties)method.voidsetDataSource(java.lang.Object ds)Injects a datasource that will be used to retrieve/create connections.voidsetDataSourceJNDI(java.lang.String jndiDS)Configure the connection pool to use a DataSource according toPoolConfiguration.setDataSource(Object)But instead of injecting the object, specify the JNDI location.voidsetDbProperties(java.util.Properties dbProperties)Overrides the database properties passed into theDriver.connect(String, Properties)method.voidsetDefaultAutoCommit(java.lang.Boolean defaultAutoCommit)The default auto-commit state of connections created by this pool.voidsetDefaultCatalog(java.lang.String defaultCatalog)If non null, during connection creation the methodConnection.setCatalog(String)will be called with the set value.voidsetDefaultReadOnly(java.lang.Boolean defaultReadOnly)If non null, during connection creation the methodConnection.setReadOnly(boolean)will be called with the set value.voidsetDefaultTransactionIsolation(int defaultTransactionIsolation)If set toDataSourceFactory.UNKNOWN_TRANSACTIONISOLATIONthe methodConnection.setTransactionIsolation(int)will not be called during connection creation.voidsetDriverClassName(java.lang.String driverClassName)The fully qualified Java class name of the JDBC driver to be used.voidsetFairQueue(boolean fairQueue)Set to true if you wish that calls to getConnection should be treated fairly in a true FIFO fashion.voidsetIgnoreExceptionOnPreLoad(boolean ignoreExceptionOnPreLoad)Set to true if you want to ignore error of connection creation while initializing the pool.voidsetInitialSize(int initialSize)Set the number of connections that will be established when the connection pool is started.voidsetInitSQL(java.lang.String initSQL)A custom query to be run when a connection is first created.voidsetJdbcInterceptors(java.lang.String jdbcInterceptors)A semicolon separated list of classnames extendingJdbcInterceptorclass.voidsetJmxEnabled(boolean jmxEnabled)If set to true, the connection pool creates aConnectionPoolMBeanobject that can be registered with JMX to receive notifications and state about the pool.voidsetLogAbandoned(boolean logAbandoned)boolean flag to set if stack traces should be logged for application code which abandoned a Connection.voidsetLogValidationErrors(boolean logValidationErrors)Set to true if you wish that errors from validation should be logged as error messages.voidsetMaxActive(int maxActive)The maximum number of active connections that can be allocated from this pool at the same time.voidsetMaxAge(long maxAge)Time in milliseconds to keep this connection before reconnecting.voidsetMaxIdle(int maxIdle)The maximum number of connections that should be kept in the idle pool ifPoolConfiguration.isPoolSweeperEnabled()returns false.voidsetMaxWait(int maxWait)The maximum number of milliseconds that the pool will wait (when there are no available connections and thePoolConfiguration.getMaxActive()has been reached) for a connection to be returned before throwing an exception.voidsetMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.voidsetMinIdle(int minIdle)The minimum number of established connections that should be kept in the pool at all times.voidsetName(java.lang.String name)Sets the name of the connection poolvoidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun)Property not usedvoidsetPassword(java.lang.String password)Sets the password to establish the connection with.voidsetPropagateInterruptState(boolean propagateInterruptState)Configure the pool to propagate interrupt state for interrupted threads waiting for a connection A thread waiting for a connection, can have its wait interrupted, and by default will clear the interrupt flag and throw aPoolExhaustedExceptionIf set to true, this behavior will change, while thePoolExhaustedExceptionis still thrown, the threads interrupted state is still set.voidsetRemoveAbandoned(boolean removeAbandoned)boolean flag to remove abandoned connections if they exceed the removeAbandonedTimeout.voidsetRemoveAbandonedTimeout(int removeAbandonedTimeout)The time in seconds before a connection can be considered abandoned.voidsetRollbackOnReturn(boolean rollbackOnReturn)Set to true if you want the connection pool to rollback any pending transaction when a connection is returned.voidsetSuspectTimeout(int seconds)Similar toPoolConfiguration.setRemoveAbandonedTimeout(int)but instead of treating the connection as abandoned, and potentially closing the connection, this simply logs the warning ifPoolConfiguration.isLogAbandoned()returns true.voidsetTestOnBorrow(boolean testOnBorrow)The indication of whether objects will be validated before being borrowed from the pool.voidsetTestOnConnect(boolean testOnConnect)Set to true if we should run the validation query when connecting to the database for the first time on a connection.voidsetTestOnReturn(boolean testOnReturn)The indication of whether objects will be validated after being returned to the pool.voidsetTestWhileIdle(boolean testWhileIdle)Set to true if query validation should take place while the connection is idle.voidsetTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing.voidsetUrl(java.lang.String url)Sets the URL used to connect to the databasevoidsetUseDisposableConnectionFacade(boolean useDisposableConnectionFacade)If set totrue, the connection will be wrapped with facade that will disallow the connection to be used afterConnection.close()is called.voidsetUseEquals(boolean useEquals)Set to true if you wish theProxyConnectionclass to useString.equalsinstead of==when comparing method names.voidsetUseLock(boolean useLock)Set to true if a lock should be used when operations are performed on the connection object.voidsetUsername(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.voidsetUseStatementFacade(boolean useStatementFacade)Set this to true if you wish to wrap statements in order to enable equals() and hashCode() methods to be called on the closed statements if any statement proxy is set.voidsetValidationInterval(long validationInterval)avoid excess validation, only run validation at most at this frequency - time in milliseconds.voidsetValidationQuery(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.voidsetValidationQueryTimeout(int validationQueryTimeout)The timeout in seconds before a connection validation queries fail.voidsetValidator(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.voidsetValidatorClassName(java.lang.String className)Set the name for an optional validator class which will be used in place of test queries.voidtestIdle()
 
- 
- 
- 
Field Detail- 
poolprotected ConnectionPool pool the connection pool
 - 
sequenceprotected java.util.concurrent.atomic.AtomicInteger sequence sequence for JMX notifications
 - 
listenersprotected java.util.concurrent.ConcurrentLinkedQueue<javax.management.NotificationListener> listeners Listeners that are local and interested in our notifications, no need for JMX
 - 
NOTIFY_INITpublic static final java.lang.String NOTIFY_INIT - See Also:
- Constant Field Values
 
 - 
NOTIFY_CONNECTpublic static final java.lang.String NOTIFY_CONNECT - See Also:
- Constant Field Values
 
 - 
NOTIFY_ABANDONpublic static final java.lang.String NOTIFY_ABANDON - See Also:
- Constant Field Values
 
 - 
SLOW_QUERY_NOTIFICATIONpublic static final java.lang.String SLOW_QUERY_NOTIFICATION - See Also:
- Constant Field Values
 
 - 
FAILED_QUERY_NOTIFICATIONpublic static final java.lang.String FAILED_QUERY_NOTIFICATION - See Also:
- Constant Field Values
 
 - 
SUSPECT_ABANDONED_NOTIFICATIONpublic static final java.lang.String SUSPECT_ABANDONED_NOTIFICATION - See Also:
- Constant Field Values
 
 - 
POOL_EMPTYpublic static final java.lang.String POOL_EMPTY - See Also:
- Constant Field Values
 
 - 
SUSPECT_RETURNED_NOTIFICATIONpublic static final java.lang.String SUSPECT_RETURNED_NOTIFICATION - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
ConnectionPoolpublic ConnectionPool(ConnectionPool pool) 
 
- 
 - 
Method Detail- 
getPoolpublic ConnectionPool getPool() 
 - 
getPoolPropertiespublic PoolConfiguration getPoolProperties() 
 - 
getObjectNamepublic javax.management.ObjectName getObjectName() 
 - 
preRegisterpublic javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name) throws java.lang.Exception- Specified by:
- preRegisterin interface- javax.management.MBeanRegistration
- Throws:
- java.lang.Exception
 
 - 
postRegisterpublic void postRegister(java.lang.Boolean registrationDone) - Specified by:
- postRegisterin interface- javax.management.MBeanRegistration
 
 - 
preDeregisterpublic void preDeregister() throws java.lang.Exception- Specified by:
- preDeregisterin interface- javax.management.MBeanRegistration
- Throws:
- java.lang.Exception
 
 - 
postDeregisterpublic void postDeregister() - Specified by:
- postDeregisterin interface- javax.management.MBeanRegistration
 
 - 
getNotificationInfopublic javax.management.MBeanNotificationInfo[] getNotificationInfo() - Specified by:
- getNotificationInfoin interface- javax.management.NotificationBroadcaster
- Overrides:
- getNotificationInfoin class- javax.management.NotificationBroadcasterSupport
 
 - 
getDefaultNotificationInfopublic static javax.management.MBeanNotificationInfo[] getDefaultNotificationInfo() 
 - 
notifypublic boolean notify(java.lang.String type, java.lang.String message)Return true if the notification was sent successfully, false otherwise.- Parameters:
- type- The notification type
- message- The message
- Returns:
- true if the notification succeeded
 
 - 
addListenerpublic void addListener(javax.management.NotificationListener list) 
 - 
removeListenerpublic boolean removeListener(javax.management.NotificationListener list) 
 - 
getSizepublic int getSize() - Specified by:
- getSizein interface- ConnectionPoolMBean
 
 - 
getIdlepublic int getIdle() - Specified by:
- getIdlein interface- ConnectionPoolMBean
 
 - 
getActivepublic int getActive() - Specified by:
- getActivein interface- ConnectionPoolMBean
 
 - 
getNumIdlepublic int getNumIdle() - Specified by:
- getNumIdlein interface- ConnectionPoolMBean
 
 - 
getNumActivepublic int getNumActive() - Specified by:
- getNumActivein interface- ConnectionPoolMBean
 
 - 
getWaitCountpublic int getWaitCount() - Specified by:
- getWaitCountin interface- ConnectionPoolMBean
 
 - 
getBorrowedCountpublic long getBorrowedCount() - Specified by:
- getBorrowedCountin interface- ConnectionPoolMBean
 
 - 
getReturnedCountpublic long getReturnedCount() - Specified by:
- getReturnedCountin interface- ConnectionPoolMBean
 
 - 
getCreatedCountpublic long getCreatedCount() - Specified by:
- getCreatedCountin interface- ConnectionPoolMBean
 
 - 
getReleasedCountpublic long getReleasedCount() - Specified by:
- getReleasedCountin interface- ConnectionPoolMBean
 
 - 
getReconnectedCountpublic long getReconnectedCount() - Specified by:
- getReconnectedCountin interface- ConnectionPoolMBean
 
 - 
getRemoveAbandonedCountpublic long getRemoveAbandonedCount() - Specified by:
- getRemoveAbandonedCountin interface- ConnectionPoolMBean
 
 - 
getReleasedIdleCountpublic long getReleasedIdleCount() - Specified by:
- getReleasedIdleCountin interface- ConnectionPoolMBean
 
 - 
checkIdlepublic void checkIdle() - Specified by:
- checkIdlein interface- ConnectionPoolMBean
 
 - 
checkAbandonedpublic void checkAbandoned() - Specified by:
- checkAbandonedin interface- ConnectionPoolMBean
 
 - 
testIdlepublic void testIdle() - Specified by:
- testIdlein interface- ConnectionPoolMBean
 
 - 
resetStatspublic void resetStats() Description copied from interface:ConnectionPoolMBeanreset the statistics of this pool.- Specified by:
- resetStatsin interface- ConnectionPoolMBean
 
 - 
getConnectionPropertiespublic java.lang.String getConnectionProperties() Description copied from interface:PoolConfigurationThe 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:
- getConnectionPropertiesin interface- PoolConfiguration
- Returns:
- the connection properties
 
 - 
getDbPropertiespublic java.util.Properties getDbProperties() Description copied from interface:PoolConfigurationReturns the database properties that are passed into theDriver.connect(String, Properties)method.- Specified by:
- getDbPropertiesin interface- PoolConfiguration
- Returns:
- database properties that are passed into the Driver.connect(String, Properties)method.
 
 - 
getDefaultCatalogpublic java.lang.String getDefaultCatalog() Description copied from interface:PoolConfigurationIf non null, during connection creation the methodConnection.setCatalog(String)will be called with the set value.- Specified by:
- getDefaultCatalogin interface- PoolConfiguration
- Returns:
- the default catalog, null if not set and accepting the driver default.
 
 - 
getDefaultTransactionIsolationpublic int getDefaultTransactionIsolation() Description copied from interface:PoolConfigurationReturns the default transaction isolation level. If set toDataSourceFactory.UNKNOWN_TRANSACTIONISOLATIONthe methodConnection.setTransactionIsolation(int)will not be called during connection creation.- Specified by:
- getDefaultTransactionIsolationin interface- PoolConfiguration
- Returns:
- driver transaction isolation level, or -1 DataSourceFactory.UNKNOWN_TRANSACTIONISOLATIONif not set.
 
 - 
getDriverClassNamepublic java.lang.String getDriverClassName() Description copied from interface:PoolConfigurationThe 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:
- getDriverClassNamein interface- PoolConfiguration
- Returns:
- fully qualified JDBC driver name.
 
 - 
getInitialSizepublic int getInitialSize() Description copied from interface:PoolConfigurationReturns the number of connections that will be established when the connection pool is started. Default value is 10- Specified by:
- getInitialSizein interface- PoolConfiguration
- Returns:
- number of connections to be started when pool is started
 
 - 
getInitSQLpublic java.lang.String getInitSQL() Description copied from interface:PoolConfigurationA 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:
- getInitSQLin interface- PoolConfiguration
- Returns:
- the init SQL used to run against the DB or null if not set
 
 - 
getJdbcInterceptorspublic java.lang.String getJdbcInterceptors() Description copied from interface:PoolConfigurationA semicolon separated list of classnames extendingJdbcInterceptorclass. These interceptors will be inserted as an interceptor into the chain of operations on a java.sql.Connection object. Example interceptors areStatementFinalizerto close all used statements during the session.ResetAbandonedTimerresets the timer upon every operation on the connection or a statement.ConnectionStatecaches the auto commit, read only and catalog settings to avoid round trips to the DB. The default value is null.- Specified by:
- getJdbcInterceptorsin interface- PoolConfiguration
- Returns:
- the interceptors that are used for connections. Example format: 'ConnectionState(useEquals=true,fast=yes);ResetAbandonedTimer'
 
 - 
getMaxActivepublic int getMaxActive() Description copied from interface:PoolConfigurationThe maximum number of active connections that can be allocated from this pool at the same time. The default value is 100- Specified by:
- getMaxActivein interface- PoolConfiguration
- Returns:
- the maximum number of connections used by this pool
 
 - 
getMaxIdlepublic int getMaxIdle() Description copied from interface:PoolConfigurationThe maximum number of connections that should be kept in the idle pool ifPoolConfiguration.isPoolSweeperEnabled()returns false. If the IfPoolConfiguration.isPoolSweeperEnabled()returns true, then the idle pool can grow up toPoolConfiguration.getMaxActive()and will be shrunk according toPoolConfiguration.getMinEvictableIdleTimeMillis()setting. Default value is maxActive:100- Specified by:
- getMaxIdlein interface- PoolConfiguration
- Returns:
- the maximum number of idle connections.
 
 - 
getMaxWaitpublic int getMaxWait() Description copied from interface:PoolConfigurationThe maximum number of milliseconds that the pool will wait (when there are no available connections and thePoolConfiguration.getMaxActive()has been reached) for a connection to be returned before throwing an exception. Default value is 30000 (30 seconds)- Specified by:
- getMaxWaitin interface- PoolConfiguration
- Returns:
- the number of milliseconds to wait for a connection to become available if the pool is maxed out.
 
 - 
getMinEvictableIdleTimeMillispublic int getMinEvictableIdleTimeMillis() Description copied from interface:PoolConfigurationThe 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:
- getMinEvictableIdleTimeMillisin interface- PoolConfiguration
- Returns:
- the minimum amount of idle time in milliseconds before a connection is considered idle and eligible for eviction.
 
 - 
getMinIdlepublic int getMinIdle() Description copied from interface:PoolConfigurationThe 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 fromPoolConfiguration.getInitialSize()(also seePoolConfiguration.setTestWhileIdle(boolean)The idle pool will not shrink below this value during an eviction run, hence the number of actual connections can be betweenPoolConfiguration.getMinIdle()and somewhere betweenPoolConfiguration.getMaxIdle()andPoolConfiguration.getMaxActive()- Specified by:
- getMinIdlein interface- PoolConfiguration
- Returns:
- the minimum number of idle or established connections
 
 - 
getMaxAgepublic long getMaxAge() Description copied from interface:PoolConfigurationTime in milliseconds to keep this connection before reconnecting. When a connection is idle, returned to the pool or borrowed from the pool, the pool will check to see if the ((now - time-when-connected) > maxAge) has been reached, and if so, it reconnects. Note that the age of idle connections will only be checked ifPoolConfiguration.getTimeBetweenEvictionRunsMillis()returns a value greater than 0. The default value is 0, which implies that connections will be left open and no age checks will be done. 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:
- getMaxAgein interface- PoolConfiguration
- Returns:
- the time in milliseconds a connection will be open for when used
 
 - 
getNamepublic java.lang.String getName() Description copied from interface:PoolConfigurationReturns the name of the connection pool. By default a JVM unique random name is assigned.- Specified by:
- getNamein interface- PoolConfiguration
- Returns:
- the name of the pool, should be unique in a JVM
 
 - 
getNumTestsPerEvictionRunpublic int getNumTestsPerEvictionRun() Description copied from interface:PoolConfigurationProperty not used- Specified by:
- getNumTestsPerEvictionRunin interface- PoolConfiguration
- Returns:
- unknown value
 
 - 
getPasswordpublic java.lang.String getPassword() Description copied from interface:PoolConfigurationReturns the password used when establishing connections to the database.- Specified by:
- getPasswordin interface- PoolConfiguration
- Returns:
- DOES NOT RETURN THE PASSWORD, IT WOULD SHOW UP IN JMX
 
 - 
getRemoveAbandonedTimeoutpublic int getRemoveAbandonedTimeout() Description copied from interface:PoolConfigurationThe time in seconds before a connection can be considered abandoned. The timer can be reset upon queries using an interceptor.- Specified by:
- getRemoveAbandonedTimeoutin interface- PoolConfiguration
- Returns:
- the time in seconds before a used connection can be considered abandoned
- See Also:
- ResetAbandonedTimer
 
 - 
getTimeBetweenEvictionRunsMillispublic int getTimeBetweenEvictionRunsMillis() Description copied from interface:PoolConfigurationThe 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:
- getTimeBetweenEvictionRunsMillisin interface- PoolConfiguration
- Returns:
- the sleep time in between validations in milliseconds
 
 - 
getUrlpublic java.lang.String getUrl() Description copied from interface:PoolConfigurationThe URL used to connect to the database- Specified by:
- getUrlin interface- PoolConfiguration
- Returns:
- the configured URL for this connection pool
- See Also:
- Driver.connect(String, Properties)
 
 - 
getUsernamepublic java.lang.String getUsername() Description copied from interface:PoolConfigurationReturns the username used to establish the connection with- Specified by:
- getUsernamein interface- PoolConfiguration
- Returns:
- the username used to establish the connection with
 
 - 
getValidationIntervalpublic long getValidationInterval() Description copied from interface:PoolConfigurationavoid 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 3000 (3 seconds).- Specified by:
- getValidationIntervalin interface- PoolConfiguration
- Returns:
- the validation interval in milliseconds
 
 - 
getValidationQuerypublic java.lang.String getValidationQuery() Description copied from interface:PoolConfigurationThe 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 an SQLException. The default value is null. Example values are SELECT 1(mysql), select 1 from dual(oracle), SELECT 1(MS Sql Server)- Specified by:
- getValidationQueryin interface- PoolConfiguration
- Returns:
- the query used for validation or null if no validation is performed
 
 - 
getValidationQueryTimeoutpublic int getValidationQueryTimeout() Description copied from interface:PoolConfigurationThe timeout in seconds before a connection validation queries fail. A value less than or equal to zero will disable this feature. Defaults to -1.- Specified by:
- getValidationQueryTimeoutin interface- PoolConfiguration
- Returns:
- the timeout value in seconds
 
 - 
getValidatorClassNamepublic java.lang.String getValidatorClassName() Return the name of the optional validator class - may be null.- Specified by:
- getValidatorClassNamein interface- PoolConfiguration
- Returns:
- the name of the optional validator class - may be null
 
 - 
getValidatorpublic Validator getValidator() - Specified by:
- getValidatorin interface- PoolConfiguration
- Returns:
- the optional validator object - may be null
 
 - 
isAccessToUnderlyingConnectionAllowedpublic boolean isAccessToUnderlyingConnectionAllowed() Description copied from interface:PoolConfigurationProperty not used. Access is always allowed. Access can be achieved by calling unwrap on the pooled connection. seeDataSourceinterface or call getConnection through reflection or cast the object asPooledConnection- Specified by:
- isAccessToUnderlyingConnectionAllowedin interface- PoolConfiguration
- Returns:
- true
 
 - 
isDefaultAutoCommitpublic java.lang.Boolean isDefaultAutoCommit() Description copied from interface:PoolConfigurationThe default auto-commit state of connections created by this pool. If not set (null), default is JDBC driver default (If set to null then theConnection.setAutoCommit(boolean)method will not be called.)- Specified by:
- isDefaultAutoCommitin interface- PoolConfiguration
- Returns:
- the default auto commit setting, null is Driver default.
 
 - 
isDefaultReadOnlypublic java.lang.Boolean isDefaultReadOnly() Description copied from interface:PoolConfigurationIf non null, during connection creation the methodConnection.setReadOnly(boolean)will be called with the set value.- Specified by:
- isDefaultReadOnlyin interface- PoolConfiguration
- Returns:
- null if not set and accepting the driver default otherwise the read only value
 
 - 
isLogAbandonedpublic boolean isLogAbandoned() Description copied from interface:PoolConfigurationboolean 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:
- isLogAbandonedin interface- PoolConfiguration
- Returns:
- true if the connection pool logs stack traces when connections are borrowed from the pool.
 
 - 
isPoolSweeperEnabledpublic boolean isPoolSweeperEnabled() Description copied from interface:PoolConfigurationReturns 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 onboolean result = getTimeBetweenEvictionRunsMillis()>0; result = result && (isRemoveAbandoned() && getRemoveAbandonedTimeout()>0); result = result || (isTestWhileIdle() && getValidationQuery()!=null); return result;- Specified by:
- isPoolSweeperEnabledin interface- PoolConfiguration
- Returns:
- true if a background thread is or will be enabled for this pool
 
 - 
isRemoveAbandonedpublic boolean isRemoveAbandoned() Description copied from interface:PoolConfigurationboolean flag to remove abandoned connections if they exceed the removeAbandonedTimeout. If set to true a connection is considered abandoned and eligible for removal if it has been in use longer than thePoolConfiguration.getRemoveAbandonedTimeout()and the condition forPoolConfiguration.getAbandonWhenPercentageFull()is met. Setting this to true can recover db connections from applications that fail to close a connection. See alsoPoolConfiguration.isLogAbandoned()The default value is false.- Specified by:
- isRemoveAbandonedin interface- PoolConfiguration
- Returns:
- true if abandoned connections can be closed and expelled out of the pool
 
 - 
getAbandonWhenPercentageFullpublic int getAbandonWhenPercentageFull() Description copied from interface:PoolConfigurationConnections 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:
- getAbandonWhenPercentageFullin interface- PoolConfiguration
- Returns:
- percentage - a value between 0 and 100 to indicate when connections that have been abandoned/timed out are considered abandoned
 
 - 
isTestOnBorrowpublic boolean isTestOnBorrow() Description copied from interface:PoolConfigurationThe 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, seePoolConfiguration.setValidationInterval(long)- Specified by:
- isTestOnBorrowin interface- PoolConfiguration
- Returns:
- true if the connection is to be validated upon borrowing a connection from the pool
- See Also:
- PoolConfiguration.getValidationInterval()
 
 - 
isTestOnConnectpublic boolean isTestOnConnect() Description copied from interface:PoolConfigurationReturns 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:
- isTestOnConnectin interface- PoolConfiguration
- Returns:
- true if we should run the validation query upon connect
 
 - 
isTestOnReturnpublic boolean isTestOnReturn() Description copied from interface:PoolConfigurationThe 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, seePoolConfiguration.setValidationInterval(long)- Specified by:
- isTestOnReturnin interface- PoolConfiguration
- Returns:
- true if validation should take place after a connection is returned to the pool
- See Also:
- PoolConfiguration.getValidationInterval()
 
 - 
isTestWhileIdlepublic boolean isTestWhileIdle() Description copied from interface:PoolConfigurationSet to true if query validation should take place while the connection is idle.- Specified by:
- isTestWhileIdlein interface- PoolConfiguration
- Returns:
- true if validation should take place during idle checks
- See Also:
- PoolConfiguration.setTimeBetweenEvictionRunsMillis(int)
 
 - 
getDefaultAutoCommitpublic java.lang.Boolean getDefaultAutoCommit() Description copied from interface:PoolConfigurationThe default auto-commit state of connections created by this pool. If not set (null), default is JDBC driver default (If set to null then theConnection.setAutoCommit(boolean)method will not be called.)- Specified by:
- getDefaultAutoCommitin interface- PoolConfiguration
- Returns:
- the default auto commit setting, null is Driver default.
 
 - 
getDefaultReadOnlypublic java.lang.Boolean getDefaultReadOnly() Description copied from interface:PoolConfigurationIf non null, during connection creation the methodConnection.setReadOnly(boolean)will be called with the set value.- Specified by:
- getDefaultReadOnlyin interface- PoolConfiguration
- Returns:
- null if not set and accepting the driver default otherwise the read only value
 
 - 
getJdbcInterceptorsAsArraypublic PoolProperties.InterceptorDefinition[] getJdbcInterceptorsAsArray() Description copied from interface:PoolConfigurationReturns thePoolConfiguration.getJdbcInterceptors()as an array of objects with properties and the classes.- Specified by:
- getJdbcInterceptorsAsArrayin interface- PoolConfiguration
- Returns:
- an array of interceptors that have been configured
 
 - 
getUseLockpublic boolean getUseLock() Description copied from interface:PoolConfigurationReturn 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:
- getUseLockin interface- PoolConfiguration
- Returns:
- true if a lock is used.
 
 - 
isFairQueuepublic boolean isFairQueue() Description copied from interface:PoolConfigurationReturnstrueif a fair queue is being used by the connection pool- Specified by:
- isFairQueuein interface- PoolConfiguration
- Returns:
- trueif a fair waiting queue is being used
 
 - 
isJmxEnabledpublic boolean isJmxEnabled() Description copied from interface:PoolConfigurationIf set to true, the connection pool creates aConnectionPoolMBeanobject 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:
- isJmxEnabledin interface- PoolConfiguration
- Returns:
- true if the mbean object will be created upon startup.
 
 - 
isUseEqualspublic boolean isUseEquals() Description copied from interface:PoolConfigurationSet to true if you wish theProxyConnectionclass to useString.equalsinstead of==when comparing method names. This property does not apply to added interceptors as those are configured individually. The default value isfalse.- Specified by:
- isUseEqualsin interface- PoolConfiguration
- Returns:
- true if pool uses String.equals(Object)instead of == when comparing method names onConnectionmethods
 
 - 
setAbandonWhenPercentageFullpublic void setAbandonWhenPercentageFull(int percentage) Description copied from interface:PoolConfigurationConnections 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:
- setAbandonWhenPercentageFullin interface- PoolConfiguration
- Parameters:
- percentage- a value between 0 and 100 to indicate when connections that have been abandoned/timed out are considered abandoned
 
 - 
setAccessToUnderlyingConnectionAllowedpublic void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed) Description copied from interface:PoolConfigurationNo-op- Specified by:
- setAccessToUnderlyingConnectionAllowedin interface- PoolConfiguration
- Parameters:
- accessToUnderlyingConnectionAllowed- parameter ignored
 
 - 
setDbPropertiespublic void setDbProperties(java.util.Properties dbProperties) Description copied from interface:PoolConfigurationOverrides the database properties passed into theDriver.connect(String, Properties)method.- Specified by:
- setDbPropertiesin interface- PoolConfiguration
- Parameters:
- dbProperties- The database properties
 
 - 
setDefaultReadOnlypublic void setDefaultReadOnly(java.lang.Boolean defaultReadOnly) Description copied from interface:PoolConfigurationIf non null, during connection creation the methodConnection.setReadOnly(boolean)will be called with the set value.- Specified by:
- setDefaultReadOnlyin interface- PoolConfiguration
- Parameters:
- defaultReadOnly- null if not set and accepting the driver default.
 
 - 
setMaxAgepublic void setMaxAge(long maxAge) Description copied from interface:PoolConfigurationTime in milliseconds to keep this connection before reconnecting. When a connection is idle, returned to the pool or borrowed from the pool, the pool will check to see if the ((now - time-when-connected) > maxAge) has been reached, and if so, it reconnects. Note that the age of idle connections will only be checked ifPoolConfiguration.getTimeBetweenEvictionRunsMillis()returns a value greater than 0. The default value is 0, which implies that connections will be left open and no age checks will be done. 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:
- setMaxAgein interface- PoolConfiguration
- Parameters:
- maxAge- the time in milliseconds a connection will be open for when used
 
 - 
setNamepublic void setName(java.lang.String name) Description copied from interface:PoolConfigurationSets the name of the connection pool- Specified by:
- setNamein interface- PoolConfiguration
- Parameters:
- name- the name of the pool, should be unique in a runtime JVM
 
 - 
getPoolNamepublic java.lang.String getPoolName() - Specified by:
- getPoolNamein interface- PoolConfiguration
- Returns:
- the pool name
- See Also:
- PoolConfiguration.getName()
 
 - 
setConnectionPropertiespublic void setConnectionProperties(java.lang.String connectionProperties) Description copied from interface:PoolConfigurationThe properties that will be passed intoDriver.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:
- setConnectionPropertiesin interface- PoolConfiguration
- Parameters:
- connectionProperties- properties - Format of the string is [propertyName=property;]* Example: prop1=value1;prop2=value2
 
 - 
setDefaultAutoCommitpublic void setDefaultAutoCommit(java.lang.Boolean defaultAutoCommit) Description copied from interface:PoolConfigurationThe default auto-commit state of connections created by this pool. If not set (null), default is JDBC driver default (If set to null then theConnection.setAutoCommit(boolean)method will not be called.)- Specified by:
- setDefaultAutoCommitin interface- PoolConfiguration
- Parameters:
- defaultAutoCommit- default auto commit setting, null is Driver default.
 
 - 
setDefaultCatalogpublic void setDefaultCatalog(java.lang.String defaultCatalog) Description copied from interface:PoolConfigurationIf non null, during connection creation the methodConnection.setCatalog(String)will be called with the set value.- Specified by:
- setDefaultCatalogin interface- PoolConfiguration
- Parameters:
- defaultCatalog- null if not set and accepting the driver default.
 
 - 
setDefaultTransactionIsolationpublic void setDefaultTransactionIsolation(int defaultTransactionIsolation) Description copied from interface:PoolConfigurationIf set toDataSourceFactory.UNKNOWN_TRANSACTIONISOLATIONthe methodConnection.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:
- setDefaultTransactionIsolationin interface- PoolConfiguration
- Parameters:
- defaultTransactionIsolation- a value of- Connection.TRANSACTION_NONE,- Connection.TRANSACTION_READ_COMMITTED,- Connection.TRANSACTION_READ_UNCOMMITTED,- Connection.TRANSACTION_REPEATABLE_READ,- Connection.TRANSACTION_SERIALIZABLEor- DataSourceFactory.UNKNOWN_TRANSACTIONISOLATIONThe last value will not be set on the connection.
 
 - 
setDriverClassNamepublic void setDriverClassName(java.lang.String driverClassName) Description copied from interface:PoolConfigurationThe 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:
- setDriverClassNamein interface- PoolConfiguration
- Parameters:
- driverClassName- a fully qualified Java class name of a- Driverimplementation.
 
 - 
setFairQueuepublic void setFairQueue(boolean fairQueue) Description copied from interface:PoolConfigurationSet to true if you wish that calls to getConnection should be treated fairly in a true FIFO fashion. This uses theFairBlockingQueueimplementation 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:
- setFairQueuein interface- PoolConfiguration
- Parameters:
- fairQueue-- trueto use a fair queue
 
 - 
setInitialSizepublic void setInitialSize(int initialSize) Description copied from interface:PoolConfigurationSet the number of connections that will be established when the connection pool is started. Default value is 10. If this value exceedsPoolConfiguration.setMaxActive(int)it will automatically be lowered.- Specified by:
- setInitialSizein interface- PoolConfiguration
- Parameters:
- initialSize- the number of connections to be established.
 
 - 
setInitSQLpublic void setInitSQL(java.lang.String initSQL) Description copied from interface:PoolConfigurationA 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:
- setInitSQLin interface- PoolConfiguration
- Parameters:
- initSQL- the init SQL used to run against the DB or null if no query should be executed
 
 - 
setJdbcInterceptorspublic void setJdbcInterceptors(java.lang.String jdbcInterceptors) Description copied from interface:PoolConfigurationA semicolon separated list of classnames extendingJdbcInterceptorclass. These interceptors will be inserted as an interceptor into the chain of operations on a java.sql.Connection object. Example interceptors areStatementFinalizerto close all used statements during the session.ResetAbandonedTimerresets the timer upon every operation on the connection or a statement.ConnectionStatecaches the auto commit, read only and catalog settings to avoid round trips to the DB. The default value is null.- Specified by:
- setJdbcInterceptorsin interface- PoolConfiguration
- Parameters:
- jdbcInterceptors- the interceptors that are used for connections. Example format: 'ConnectionState(useEquals=true,fast=yes);ResetAbandonedTimer'
 
 - 
setJmxEnabledpublic void setJmxEnabled(boolean jmxEnabled) Description copied from interface:PoolConfigurationIf set to true, the connection pool creates aConnectionPoolMBeanobject 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:
- setJmxEnabledin interface- PoolConfiguration
- Parameters:
- jmxEnabled- set to to if the mbean object should be created upon startup.
 
 - 
setLogAbandonedpublic void setLogAbandoned(boolean logAbandoned) Description copied from interface:PoolConfigurationboolean 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:
- setLogAbandonedin interface- PoolConfiguration
- Parameters:
- logAbandoned- set to true if stack traces should be recorded when- DataSourceProxy.getConnection()is called.
 
 - 
setMaxActivepublic void setMaxActive(int maxActive) Description copied from interface:PoolConfigurationThe maximum number of active connections that can be allocated from this pool at the same time. The default value is 100- Specified by:
- setMaxActivein interface- PoolConfiguration
- Parameters:
- maxActive- hard limit for number of managed connections by this pool
 
 - 
setMaxIdlepublic void setMaxIdle(int maxIdle) Description copied from interface:PoolConfigurationThe maximum number of connections that should be kept in the idle pool ifPoolConfiguration.isPoolSweeperEnabled()returns false. If the IfPoolConfiguration.isPoolSweeperEnabled()returns true, then the idle pool can grow up toPoolConfiguration.getMaxActive()and will be shrunk according toPoolConfiguration.getMinEvictableIdleTimeMillis()setting. Default value is maxActive:100- Specified by:
- setMaxIdlein interface- PoolConfiguration
- Parameters:
- maxIdle- the maximum size of the idle pool
 
 - 
setMaxWaitpublic void setMaxWait(int maxWait) Description copied from interface:PoolConfigurationThe maximum number of milliseconds that the pool will wait (when there are no available connections and thePoolConfiguration.getMaxActive()has been reached) for a connection to be returned before throwing an exception. Default value is 30000 (30 seconds)- Specified by:
- setMaxWaitin interface- PoolConfiguration
- Parameters:
- maxWait- the maximum number of milliseconds to wait.
 
 - 
setMinEvictableIdleTimeMillispublic void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) Description copied from interface:PoolConfigurationThe 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:
- setMinEvictableIdleTimeMillisin interface- PoolConfiguration
- Parameters:
- minEvictableIdleTimeMillis- the number of milliseconds a connection must be idle to be eligible for eviction.
 
 - 
setMinIdlepublic void setMinIdle(int minIdle) Description copied from interface:PoolConfigurationThe 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 fromPoolConfiguration.getInitialSize()(also seePoolConfiguration.setTestWhileIdle(boolean)The idle pool will not shrink below this value during an eviction run, hence the number of actual connections can be betweenPoolConfiguration.getMinIdle()and somewhere betweenPoolConfiguration.getMaxIdle()andPoolConfiguration.getMaxActive()- Specified by:
- setMinIdlein interface- PoolConfiguration
- Parameters:
- minIdle- the minimum number of idle or established connections
 
 - 
setNumTestsPerEvictionRunpublic void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) Description copied from interface:PoolConfigurationProperty not used- Specified by:
- setNumTestsPerEvictionRunin interface- PoolConfiguration
- Parameters:
- numTestsPerEvictionRun- parameter ignored.
 
 - 
setPasswordpublic void setPassword(java.lang.String password) Description copied from interface:PoolConfigurationSets the password to establish the connection with. The password will be included as a database property with the name 'password'.- Specified by:
- setPasswordin interface- PoolConfiguration
- Parameters:
- password- The password
- See Also:
- PoolConfiguration.getDbProperties()
 
 - 
setRemoveAbandonedpublic void setRemoveAbandoned(boolean removeAbandoned) Description copied from interface:PoolConfigurationboolean flag to remove abandoned connections if they exceed the removeAbandonedTimeout. If set to true a connection is considered abandoned and eligible for removal if it has been in use longer than thePoolConfiguration.getRemoveAbandonedTimeout()and the condition forPoolConfiguration.getAbandonWhenPercentageFull()is met. Setting this to true can recover db connections from applications that fail to close a connection. See alsoPoolConfiguration.isLogAbandoned()The default value is false.- Specified by:
- setRemoveAbandonedin interface- PoolConfiguration
- Parameters:
- removeAbandoned- set to true if abandoned connections can be closed and expelled out of the pool
 
 - 
setRemoveAbandonedTimeoutpublic void setRemoveAbandonedTimeout(int removeAbandonedTimeout) Description copied from interface:PoolConfigurationThe time in seconds before a connection can be considered abandoned. The timer can be reset upon queries using an interceptor.- Specified by:
- setRemoveAbandonedTimeoutin interface- PoolConfiguration
- Parameters:
- removeAbandonedTimeout- the time in seconds before a used connection can be considered abandoned
- See Also:
- ResetAbandonedTimer
 
 - 
setTestOnBorrowpublic void setTestOnBorrow(boolean testOnBorrow) Description copied from interface:PoolConfigurationThe 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, seePoolConfiguration.setValidationInterval(long)- Specified by:
- setTestOnBorrowin 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()
 
 - 
setTestOnConnectpublic void setTestOnConnect(boolean testOnConnect) Description copied from interface:PoolConfigurationSet 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 anPoolConfiguration.setInitSQL(String)will override this setting, as the init SQL will be used instead of the validation query- Specified by:
- setTestOnConnectin interface- PoolConfiguration
- Parameters:
- testOnConnect- set to true if we should run the validation query upon connect
 
 - 
setTestOnReturnpublic void setTestOnReturn(boolean testOnReturn) Description copied from interface:PoolConfigurationThe 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, seePoolConfiguration.setValidationInterval(long)- Specified by:
- setTestOnReturnin interface- PoolConfiguration
- Parameters:
- testOnReturn- true if validation should take place after a connection is returned to the pool
- See Also:
- PoolConfiguration.getValidationInterval()
 
 - 
setTestWhileIdlepublic void setTestWhileIdle(boolean testWhileIdle) Description copied from interface:PoolConfigurationSet to true if query validation should take place while the connection is idle.- Specified by:
- setTestWhileIdlein interface- PoolConfiguration
- Parameters:
- testWhileIdle- true if validation should take place during idle checks
- See Also:
- PoolConfiguration.setTimeBetweenEvictionRunsMillis(int)
 
 - 
setTimeBetweenEvictionRunsMillispublic void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) Description copied from interface:PoolConfigurationThe 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:
- setTimeBetweenEvictionRunsMillisin interface- PoolConfiguration
- Parameters:
- timeBetweenEvictionRunsMillis- the sleep time in between validations in milliseconds
 
 - 
setUrlpublic void setUrl(java.lang.String url) Description copied from interface:PoolConfigurationSets the URL used to connect to the database- Specified by:
- setUrlin interface- PoolConfiguration
- Parameters:
- url- the configured URL for this connection pool
- See Also:
- Driver.connect(String, Properties)
 
 - 
setUseEqualspublic void setUseEquals(boolean useEquals) Description copied from interface:PoolConfigurationSet to true if you wish theProxyConnectionclass to useString.equalsinstead of==when comparing method names. This property does not apply to added interceptors as those are configured individually. The default value isfalse.- Specified by:
- setUseEqualsin interface- PoolConfiguration
- Parameters:
- useEquals- set to true if the pool should use- String.equals(Object)instead of == when comparing method names on- Connectionmethods
 
 - 
setUseLockpublic void setUseLock(boolean useLock) Description copied from interface:PoolConfigurationSet 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:
- setUseLockin interface- PoolConfiguration
- Parameters:
- useLock- set to true if a lock should be used on connection operations
 
 - 
setUsernamepublic void setUsername(java.lang.String username) Description copied from interface:PoolConfigurationSets the username used to establish the connection with It will also be a property called 'user' in the database properties.- Specified by:
- setUsernamein interface- PoolConfiguration
- Parameters:
- username- The user name
- See Also:
- PoolConfiguration.getDbProperties()
 
 - 
setValidationIntervalpublic void setValidationInterval(long validationInterval) Description copied from interface:PoolConfigurationavoid 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 3000 (3 seconds).- Specified by:
- setValidationIntervalin interface- PoolConfiguration
- Parameters:
- validationInterval- the validation interval in milliseconds
 
 - 
setValidationQuerypublic void setValidationQuery(java.lang.String validationQuery) Description copied from interface:PoolConfigurationThe 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 an SQLException. The default value is null. Example values are SELECT 1(mysql), select 1 from dual(oracle), SELECT 1(MS Sql Server)- Specified by:
- setValidationQueryin interface- PoolConfiguration
- Parameters:
- validationQuery- the query used for validation or null if no validation is performed
 
 - 
setValidationQueryTimeoutpublic void setValidationQueryTimeout(int validationQueryTimeout) Description copied from interface:PoolConfigurationThe timeout in seconds before a connection validation queries fail. A value less than or equal to zero will disable this feature. Defaults to -1.- Specified by:
- setValidationQueryTimeoutin interface- PoolConfiguration
- Parameters:
- validationQueryTimeout- The timeout value
 
 - 
setValidatorClassNamepublic 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:
- setValidatorClassNamein interface- PoolConfiguration
- Parameters:
- className- the name of the optional validator class
 
 - 
getSuspectTimeoutpublic int getSuspectTimeout() Returns the time in seconds to pass before a connection is marked an abandoned suspect. Any value lesser than or equal to 0 means the check is disabled.- Specified by:
- getSuspectTimeoutin interface- PoolConfiguration
- Returns:
- Returns the time in seconds to pass before a connection is marked an abandoned suspect.
 
 - 
setSuspectTimeoutpublic void setSuspectTimeout(int seconds) Similar toPoolConfiguration.setRemoveAbandonedTimeout(int)but instead of treating the connection as abandoned, and potentially closing the connection, this simply logs the warning ifPoolConfiguration.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:
- setSuspectTimeoutin interface- PoolConfiguration
- Parameters:
- seconds- - the amount of time in seconds that has to pass before a connection is marked suspect.
 
 - 
setDataSourcepublic void setDataSource(java.lang.Object ds) Injects a datasource that will be used to retrieve/create connections. If a data source is set, thePoolConfiguration.getUrl()andPoolConfiguration.getDriverClassName()methods are ignored and not used by the pool. If thePoolConfiguration.getUsername()andPoolConfiguration.getPassword()values are set, the methodDataSource.getConnection(String, String)method will be called instead of theDataSource.getConnection()method. If the data source implementsXADataSourcethe methodsXADataSource.getXAConnection()andXADataSource.getXAConnection(String,String)will be invoked.- Specified by:
- setDataSourcein interface- PoolConfiguration
- Parameters:
- ds- the- DataSourceto be used for creating connections to be pooled.
 
 - 
getDataSourcepublic 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 aDriver- Specified by:
- getDataSourcein interface- PoolConfiguration
- Returns:
- the DataSourceto be used for creating connections to be pooled or null if a Driver is used.
 
 - 
setDataSourceJNDIpublic void setDataSourceJNDI(java.lang.String jndiDS) Configure the connection pool to use a DataSource according toPoolConfiguration.setDataSource(Object)But instead of injecting the object, specify the JNDI location. After a successful JNDI look, thePoolConfiguration.getDataSource()will not return null.- Specified by:
- setDataSourceJNDIin interface- PoolConfiguration
- Parameters:
- jndiDS- -the JNDI string @TODO specify the rules here.
 
 - 
getDataSourceJNDIpublic java.lang.String getDataSourceJNDI() Returns the JNDI string configured for data source usage.- Specified by:
- getDataSourceJNDIin interface- PoolConfiguration
- Returns:
- the JNDI string or null if not set
 
 - 
isAlternateUsernameAllowedpublic boolean isAlternateUsernameAllowed() Returns true if the callgetConnection(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:
- isAlternateUsernameAllowedin interface- PoolConfiguration
- Returns:
- true if getConnection(username,password)is honored, false if it is ignored.
 
 - 
setAlternateUsernameAllowedpublic void setAlternateUsernameAllowed(boolean alternateUsernameAllowed) Set to true if the callgetConnection(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:
- setAlternateUsernameAllowedin interface- PoolConfiguration
- Parameters:
- alternateUsernameAllowed- - set true if- getConnection(username,password)is honored, false if it is to be ignored.
 
 - 
setValidatorpublic 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:
- setValidatorin interface- PoolConfiguration
- Parameters:
- validator- The validator object
 
 - 
setCommitOnReturnpublic void setCommitOnReturn(boolean commitOnReturn) Set to true if you want the connection pool to commit any pending transaction when a connection is returned. The default value is false, as this could result in committing data. This parameter is only looked at if thePoolConfiguration.getDefaultAutoCommit()returns false- Specified by:
- setCommitOnReturnin interface- PoolConfiguration
- Parameters:
- commitOnReturn- set to true if the pool should call- Connection.commit()when a connection is returned to the pool. Default is false
 
 - 
getCommitOnReturnpublic boolean getCommitOnReturn() - Specified by:
- getCommitOnReturnin interface- PoolConfiguration
- Returns:
- trueif the pool should commit when a connection is returned to it
- See Also:
- PoolConfiguration.setCommitOnReturn(boolean)
 
 - 
setRollbackOnReturnpublic void setRollbackOnReturn(boolean rollbackOnReturn) Set to true if you want the connection pool to rollback any pending transaction when a connection is returned. The default value is false, as this could result in committing data. This parameter is only looked at if thePoolConfiguration.getDefaultAutoCommit()returns false- Specified by:
- setRollbackOnReturnin interface- PoolConfiguration
- Parameters:
- rollbackOnReturn- set to true if the pool should call- Connection.rollback()when a connection is returned to the pool. Default is false
 
 - 
getRollbackOnReturnpublic boolean getRollbackOnReturn() - Specified by:
- getRollbackOnReturnin interface- PoolConfiguration
- Returns:
- trueif the pool should rollback when a connection is returned to it
- See Also:
- PoolConfiguration.setRollbackOnReturn(boolean)
 
 - 
setUseDisposableConnectionFacadepublic void setUseDisposableConnectionFacade(boolean useDisposableConnectionFacade) If set totrue, the connection will be wrapped with facade that will disallow the connection to be used afterConnection.close()is called. If set totrue, afterConnection.close()all calls exceptConnection.close()andConnection.isClosed()will throw an exception.- Specified by:
- setUseDisposableConnectionFacadein interface- PoolConfiguration
- Parameters:
- useDisposableConnectionFacade-- trueto use a facade
 
 - 
getUseDisposableConnectionFacadepublic boolean getUseDisposableConnectionFacade() Returnstrueif this connection pool is configured to use a connection facade to prevent re-use of connection afterConnection.close()has been invoked- Specified by:
- getUseDisposableConnectionFacadein interface- PoolConfiguration
- Returns:
- trueif- Connection.close()has been invoked.
 
 - 
setLogValidationErrorspublic void setLogValidationErrors(boolean logValidationErrors) Set to true if you wish that errors from validation should be logged as error messages.- Specified by:
- setLogValidationErrorsin interface- PoolConfiguration
- Parameters:
- logValidationErrors- set to true to log validation errors
 
 - 
getLogValidationErrorspublic boolean getLogValidationErrors() Returns true if errors that happen during validation will be logged- Specified by:
- getLogValidationErrorsin interface- PoolConfiguration
- Returns:
- true if errors that happen during validation will be logged
 
 - 
getPropagateInterruptStatepublic boolean getPropagateInterruptState() Returns true if the pool is configured to propagate interrupt state of a thread. A thread waiting for a connection, can have its wait interrupted, and by default will clear the interrupt flag and throw aPoolExhaustedException- Specified by:
- getPropagateInterruptStatein interface- PoolConfiguration
- Returns:
- true if the pool is configured to propagate and not clear the thread interrupt state
 
 - 
setPropagateInterruptStatepublic void setPropagateInterruptState(boolean propagateInterruptState) Configure the pool to propagate interrupt state for interrupted threads waiting for a connection A thread waiting for a connection, can have its wait interrupted, and by default will clear the interrupt flag and throw aPoolExhaustedExceptionIf set to true, this behavior will change, while thePoolExhaustedExceptionis still thrown, the threads interrupted state is still set.- Specified by:
- setPropagateInterruptStatein interface- PoolConfiguration
- Parameters:
- propagateInterruptState- - set to true to not clear, but propagate, a threads interrupted state.
 
 - 
isIgnoreExceptionOnPreLoadpublic boolean isIgnoreExceptionOnPreLoad() - Specified by:
- isIgnoreExceptionOnPreLoadin interface- PoolConfiguration
- Returns:
- trueto ignore exceptions
- See Also:
- PoolConfiguration.setIgnoreExceptionOnPreLoad(boolean)
 
 - 
setIgnoreExceptionOnPreLoadpublic void setIgnoreExceptionOnPreLoad(boolean ignoreExceptionOnPreLoad) Set to true if you want to ignore error of connection creation while initializing the pool. Set to false if you want to fail the initialization of the pool by throwing exception.- Specified by:
- setIgnoreExceptionOnPreLoadin interface- PoolConfiguration
- Parameters:
- ignoreExceptionOnPreLoad- set to true if you want to ignore error of connection creation while initializing the pool.
 
 - 
getUseStatementFacadepublic boolean getUseStatementFacade() Returnstrueif this connection pool is configured to wrap statements in order to enable equals() and hashCode() methods to be called on the closed statements if any statement proxy is set.- Specified by:
- getUseStatementFacadein interface- PoolConfiguration
- Returns:
- trueif the statements are wrapped
 
 - 
setUseStatementFacadepublic void setUseStatementFacade(boolean useStatementFacade) Set this to true if you wish to wrap statements in order to enable equals() and hashCode() methods to be called on the closed statements if any statement proxy is set.- Specified by:
- setUseStatementFacadein interface- PoolConfiguration
- Parameters:
- useStatementFacade- set to- trueto wrap statements
 
 - 
purgepublic void purge() Purges all connections in the pool. For connections currently in use, these connections will be purged when returned on the pool. This call also purges connections that are idle and in the pool To only purge used/active connections seeConnectionPoolMBean.purgeOnReturn()- Specified by:
- purgein interface- ConnectionPoolMBean
 
 - 
purgeOnReturnpublic void purgeOnReturn() Purges connections when they are returned from the pool. This call does not purge idle connections until they are used. To purge idle connections seeConnectionPoolMBean.purge()- Specified by:
- purgeOnReturnin interface- ConnectionPoolMBean
 
 
- 
 
-