Class BasicDataSource
- java.lang.Object
-
- org.apache.commons.dbcp2.BasicDataSource
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.Wrapper,javax.management.MBeanRegistration,javax.sql.CommonDataSource,javax.sql.DataSource,BasicDataSourceMXBean
- Direct Known Subclasses:
BasicManagedDataSource
public class BasicDataSource extends java.lang.Object implements javax.sql.DataSource, BasicDataSourceMXBean, javax.management.MBeanRegistration, java.lang.AutoCloseable
Basic implementation of
javax.sql.DataSourcethat is configured via JavaBeans properties. This is not the only way to combine the commons-dbcp and commons-pool packages, but provides a "one stop shopping" solution for basic requirements.- Since:
- 2.0
- Version:
- $Id: BasicDataSource.java 1693836 2015-08-02 22:51:27Z psteitz $
- Author:
- Glenn L. Nielsen, Craig R. McClanahan, Dirk Verbeeck
-
-
Constructor Summary
Constructors Constructor Description BasicDataSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectionProperty(java.lang.String name, java.lang.String value)Add a custom connection property to the set that will be passed to our JDBC driver.voidclose()Closes and releases all idle connections that are currently stored in the connection pool associated with this data source.java.io.PrintWritergetAbandonedLogWriter()Gets the log writer to be used by this configuration to log information on abandoned objects.booleangetAbandonedUsageTracking()If the connection pool implementsUsageTracking, should the connection pool record a stack trace every time a method is called on a pooled connection and retain the most recent stack trace to aid debugging of abandoned connections?booleangetCacheState()Returns the state caching flag.java.sql.ConnectiongetConnection()Create (if necessary) and return a connection to the database.java.sql.ConnectiongetConnection(java.lang.String user, java.lang.String pass)BasicDataSource does NOT support this method.java.util.List<java.lang.String>getConnectionInitSqls()Returns the list of SQL statements executed when a physical connection is first created.java.lang.String[]getConnectionInitSqlsAsArray()Provides the same data asgetConnectionInitSqls()but in an array so it is accessible via JMX.java.lang.BooleangetDefaultAutoCommit()Returns the default auto-commit property.java.lang.StringgetDefaultCatalog()Returns the default catalog.java.lang.IntegergetDefaultQueryTimeout()Obtain the default query timeout that will be used forStatements created from this connection.java.lang.BooleangetDefaultReadOnly()Returns the default readOnly property.intgetDefaultTransactionIsolation()Returns the default transaction isolation state of returned connections.java.util.Set<java.lang.String>getDisconnectionSqlCodes()Returns the set of SQL_STATE codes considered to signal fatal conditions.java.lang.String[]getDisconnectionSqlCodesAsArray()Provides the same data asgetDisconnectionSqlCodes()but in an array so it is accessible via JMX.java.sql.DrivergetDriver()Returns the JDBC Driver that has been configured for use by this pool.java.lang.ClassLoadergetDriverClassLoader()Returns the class loader specified for loading the JDBC driver.java.lang.StringgetDriverClassName()Returns the jdbc driver class name.booleangetEnableAutoCommitOnReturn()Returns the value of the flag that controls whether or not connections being returned to the pool will be checked and configured withConnection.setAutoCommit(true)if the auto commit setting isfalsewhen the connection is returned.java.lang.StringgetEvictionPolicyClassName()Gets the EvictionPolicy implementation in use with this connection pool.booleangetFastFailValidation()True means that validation will fail immediately for connections that have previously thrown SQLExceptions with SQL_STATE indicating fatal disconnection errors.intgetInitialSize()Returns the initial size of the connection pool.java.lang.StringgetJmxName()Returns the JMX name that has been requested for this DataSource.booleangetLifo()Returns the LIFO property.booleangetLogAbandoned()Flag to log stack traces for application code which abandoned a Statement or Connection.booleangetLogExpiredConnections()WhengetMaxConnLifetimeMillis()is set to limit connection lifetime, this property determines whether or not log messages are generated when the pool closes connections due to maximum lifetime exceeded.intgetLoginTimeout()BasicDataSource does NOT support this method.java.io.PrintWritergetLogWriter()Returns the log writer being used by this data source.longgetMaxConnLifetimeMillis()Returns the maximum permitted lifetime of a connection in milliseconds.intgetMaxIdle()Returns the maximum number of connections that can remain idle in the pool.intgetMaxOpenPreparedStatements()Gets the value of themaxOpenPreparedStatementsproperty.intgetMaxTotal()Returns the maximum number of active connections that can be allocated at the same time.longgetMaxWaitMillis()Returns the maximum number of milliseconds that the pool will wait for a connection to be returned before throwing an exception.longgetMinEvictableIdleTimeMillis()Returns theminEvictableIdleTimeMillisproperty.intgetMinIdle()Returns the minimum number of idle connections in the pool.intgetNumActive()[Read Only] The current number of active connections that have been allocated from this data source.intgetNumIdle()[Read Only] The current number of idle connections that are waiting to be allocated from this data source.intgetNumTestsPerEvictionRun()Returns the value of thenumTestsPerEvictionRunproperty.java.util.logging.LoggergetParentLogger()java.lang.StringgetPassword()Returns the password passed to the JDBC driver to establish connections.booleangetRemoveAbandonedOnBorrow()Flag to remove abandoned connections if they exceed the removeAbandonedTimeout when borrowObject is invoked.booleangetRemoveAbandonedOnMaintenance()Flag to remove abandoned connections if they exceed the removeAbandonedTimeout during pool maintenance.intgetRemoveAbandonedTimeout()Timeout in seconds before an abandoned connection can be removed.booleangetRollbackOnReturn()Gets the current value of the flag that controls if a connection will be rolled back when it is returned to the pool if auto commit is not enabled and the connection is not read only.longgetSoftMinEvictableIdleTimeMillis()Returns the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.booleangetTestOnBorrow()Returns thetestOnBorrowproperty.booleangetTestOnCreate()Returns thetestOnCreateproperty.booleangetTestOnReturn()Returns the value of thetestOnReturnproperty.booleangetTestWhileIdle()Returns the value of thetestWhileIdleproperty.longgetTimeBetweenEvictionRunsMillis()Returns the value of thetimeBetweenEvictionRunsMillisproperty.java.lang.StringgetUrl()Returns the JDBC connectionurlproperty.java.lang.StringgetUsername()Returns the JDBC connectionusernameproperty.java.lang.StringgetValidationQuery()Returns the validation query used to validate connections before returning them.intgetValidationQueryTimeout()Returns the validation query timeout.voidinvalidateConnection(java.sql.Connection connection)Manually invalidates a connection, effectively requesting the pool to try to close it, remove it from the pool and reclaim pool capacity.booleanisAccessToUnderlyingConnectionAllowed()Returns the value of the accessToUnderlyingConnectionAllowed property.booleanisClosed()If true, this data source is closed and no more connections can be retrieved from this datasource.booleanisPoolPreparedStatements()Returns true if we are pooling statements.booleanisWrapperFor(java.lang.Class<?> iface)voidpostDeregister()voidpostRegister(java.lang.Boolean registrationDone)voidpreDeregister()javax.management.ObjectNamepreRegister(javax.management.MBeanServer server, javax.management.ObjectName name)voidremoveConnectionProperty(java.lang.String name)Remove a custom connection property.voidsetAbandonedLogWriter(java.io.PrintWriter logWriter)Sets the log writer to be used by this configuration to log information on abandoned objects.voidsetAbandonedUsageTracking(boolean usageTracking)If the connection pool implementsUsageTracking, configure whether the connection pool should record a stack trace every time a method is called on a pooled connection and retain the most recent stack trace to aid debugging of abandoned connections.voidsetAccessToUnderlyingConnectionAllowed(boolean allow)Sets the value of the accessToUnderlyingConnectionAllowed property.voidsetCacheState(boolean cacheState)Sets the state caching flag.voidsetConnectionInitSqls(java.util.Collection<java.lang.String> connectionInitSqls)Sets the list of SQL statements to be executed when a physical connection is first created.voidsetConnectionProperties(java.lang.String connectionProperties)Sets the connection properties passed to driver.connect(...).voidsetDefaultAutoCommit(java.lang.Boolean defaultAutoCommit)Sets default auto-commit state of connections returned by this datasource.voidsetDefaultCatalog(java.lang.String defaultCatalog)Sets the default catalog.voidsetDefaultQueryTimeout(java.lang.Integer defaultQueryTimeout)Set the default query timeout that will be used forStatements created from this connection.voidsetDefaultReadOnly(java.lang.Boolean defaultReadOnly)Sets defaultReadonly property.voidsetDefaultTransactionIsolation(int defaultTransactionIsolation)Sets the default transaction isolation state for returned connections.voidsetDisconnectionSqlCodes(java.util.Collection<java.lang.String> disconnectionSqlCodes)Sets the SQL_STATE codes considered to signal fatal conditions.voidsetDriver(java.sql.Driver driver)Sets the JDBC Driver instance to use for this pool.voidsetDriverClassLoader(java.lang.ClassLoader driverClassLoader)Sets the class loader to be used to load the JDBC driver.voidsetDriverClassName(java.lang.String driverClassName)Sets the jdbc driver class name.voidsetEnableAutoCommitOnReturn(boolean enableAutoCommitOnReturn)Sets the value of the flag that controls whether or not connections being returned to the pool will be checked and configured withConnection.setAutoCommit(true)if the auto commit setting isfalsewhen the connection is returned.voidsetEvictionPolicyClassName(java.lang.String evictionPolicyClassName)Sets the EvictionPolicy implementation to use with this connection pool.voidsetFastFailValidation(boolean fastFailValidation)voidsetInitialSize(int initialSize)Sets the initial size of the connection pool.voidsetJmxName(java.lang.String jmxName)Sets the JMX name that has been requested for this DataSource.voidsetLifo(boolean lifo)Sets the LIFO property.voidsetLogAbandoned(boolean logAbandoned)voidsetLogExpiredConnections(boolean logExpiredConnections)WhengetMaxConnLifetimeMillis()is set to limit connection lifetime, this property determines whether or not log messages are generated when the pool closes connections due to maximum lifetime exceeded.voidsetLoginTimeout(int loginTimeout)BasicDataSource does NOT support this method.voidsetLogWriter(java.io.PrintWriter logWriter)Sets the log writer being used by this data source.voidsetMaxConnLifetimeMillis(long maxConnLifetimeMillis)Sets the maximum permitted lifetime of a connection in milliseconds.voidsetMaxIdle(int maxIdle)Sets the maximum number of connections that can remain idle in the pool.voidsetMaxOpenPreparedStatements(int maxOpenStatements)Sets the value of themaxOpenPreparedStatementsproperty.voidsetMaxTotal(int maxTotal)Sets the maximum total number of idle and borrows connections that can be active at the same time.voidsetMaxWaitMillis(long maxWaitMillis)Sets the MaxWaitMillis property.voidsetMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)Sets theminEvictableIdleTimeMillisproperty.voidsetMinIdle(int minIdle)Sets the minimum number of idle connections in the pool.voidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun)Sets the value of thenumTestsPerEvictionRunproperty.voidsetPassword(java.lang.String password)Sets thepassword.voidsetPoolPreparedStatements(boolean poolingStatements)Sets whether to pool statements or not.voidsetRemoveAbandonedOnBorrow(boolean removeAbandonedOnBorrow)voidsetRemoveAbandonedOnMaintenance(boolean removeAbandonedOnMaintenance)voidsetRemoveAbandonedTimeout(int removeAbandonedTimeout)Sets the timeout in seconds before an abandoned connection can be removed.voidsetRollbackOnReturn(boolean rollbackOnReturn)Sets the flag that controls if a connection will be rolled back when it is returned to the pool if auto commit is not enabled and the connection is not read only.voidsetSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis)Sets the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.voidsetTestOnBorrow(boolean testOnBorrow)Sets thetestOnBorrowproperty.voidsetTestOnCreate(boolean testOnCreate)Sets thetestOnCreateproperty.voidsetTestOnReturn(boolean testOnReturn)Sets thetestOnReturnproperty.voidsetTestWhileIdle(boolean testWhileIdle)Sets thetestWhileIdleproperty.voidsetTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)Sets thetimeBetweenEvictionRunsMillisproperty.voidsetUrl(java.lang.String url)Sets theurl.voidsetUsername(java.lang.String username)Sets theusername.voidsetValidationQuery(java.lang.String validationQuery)Sets thevalidationQuery.voidsetValidationQueryTimeout(int timeout)Sets the validation query timeout, the amount of time, in seconds, that connection validation will wait for a response from the database when executing a validation query.<T> Tunwrap(java.lang.Class<T> iface)
-
-
-
Method Detail
-
getDefaultAutoCommit
public java.lang.Boolean getDefaultAutoCommit()
Returns the default auto-commit property.- Specified by:
getDefaultAutoCommitin interfaceBasicDataSourceMXBean- Returns:
- true if default auto-commit is enabled
-
setDefaultAutoCommit
public void setDefaultAutoCommit(java.lang.Boolean defaultAutoCommit)
Sets default auto-commit state of connections returned by this datasource.
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
defaultAutoCommit- default auto-commit value
-
getDefaultReadOnly
public java.lang.Boolean getDefaultReadOnly()
Returns the default readOnly property.- Specified by:
getDefaultReadOnlyin interfaceBasicDataSourceMXBean- Returns:
- true if connections are readOnly by default
-
setDefaultReadOnly
public void setDefaultReadOnly(java.lang.Boolean defaultReadOnly)
Sets defaultReadonly property.
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
defaultReadOnly- default read-only value
-
getDefaultTransactionIsolation
public int getDefaultTransactionIsolation()
Returns the default transaction isolation state of returned connections.- Specified by:
getDefaultTransactionIsolationin interfaceBasicDataSourceMXBean- Returns:
- the default value for transaction isolation state
- See Also:
Connection.getTransactionIsolation()
-
setDefaultTransactionIsolation
public void setDefaultTransactionIsolation(int defaultTransactionIsolation)
Sets the default transaction isolation state for returned connections.
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
defaultTransactionIsolation- the default transaction isolation state- See Also:
Connection.getTransactionIsolation()
-
getDefaultQueryTimeout
public java.lang.Integer getDefaultQueryTimeout()
Obtain the default query timeout that will be used forStatements created from this connection.nullmeans that the driver default will be used.
-
setDefaultQueryTimeout
public void setDefaultQueryTimeout(java.lang.Integer defaultQueryTimeout)
Set the default query timeout that will be used forStatements created from this connection.nullmeans that the driver default will be used.
-
getDefaultCatalog
public java.lang.String getDefaultCatalog()
Returns the default catalog.- Specified by:
getDefaultCatalogin interfaceBasicDataSourceMXBean- Returns:
- the default catalog
-
setDefaultCatalog
public void setDefaultCatalog(java.lang.String defaultCatalog)
Sets the default catalog.
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
defaultCatalog- the default catalog
-
getCacheState
public boolean getCacheState()
Returns the state caching flag.- Specified by:
getCacheStatein interfaceBasicDataSourceMXBean- Returns:
- the state caching flag
-
setCacheState
public void setCacheState(boolean cacheState)
Sets the state caching flag.- Parameters:
cacheState- The new value for the state caching flag
-
getDriver
public java.sql.Driver getDriver()
Returns the JDBC Driver that has been configured for use by this pool.Note: This getter only returns the last value set by a call to
setDriver(Driver). It does not return any driver instance that may have been created from the value set viasetDriverClassName(String).- Returns:
- the JDBC Driver that has been configured for use by this pool
-
setDriver
public void setDriver(java.sql.Driver driver)
Sets the JDBC Driver instance to use for this pool.Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
driver-
-
getDriverClassName
public java.lang.String getDriverClassName()
Returns the jdbc driver class name.Note: This getter only returns the last value set by a call to
setDriverClassName(String). It does not return the class name of any driver that may have been set viasetDriver(Driver).- Specified by:
getDriverClassNamein interfaceBasicDataSourceMXBean- Returns:
- the jdbc driver class name
-
setDriverClassName
public void setDriverClassName(java.lang.String driverClassName)
Sets the jdbc driver class name.
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
driverClassName- the class name of the jdbc driver
-
getDriverClassLoader
public java.lang.ClassLoader getDriverClassLoader()
Returns the class loader specified for loading the JDBC driver. Returnsnullif no class loader has been explicitly specified.Note: This getter only returns the last value set by a call to
setDriverClassLoader(ClassLoader). It does not return the class loader of any driver that may have been set viasetDriver(Driver).
-
setDriverClassLoader
public void setDriverClassLoader(java.lang.ClassLoader driverClassLoader)
Sets the class loader to be used to load the JDBC driver.
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
driverClassLoader- the class loader with which to load the JDBC driver
-
getLifo
public boolean getLifo()
Returns the LIFO property.- Specified by:
getLifoin interfaceBasicDataSourceMXBean- Returns:
- true if connection pool behaves as a LIFO queue.
-
setLifo
public void setLifo(boolean lifo)
Sets the LIFO property. True means the pool behaves as a LIFO queue; false means FIFO.- Parameters:
lifo- the new value for the LIFO property
-
getMaxTotal
public int getMaxTotal()
Returns the maximum number of active connections that can be allocated at the same time.
A negative number means that there is no limit.
- Specified by:
getMaxTotalin interfaceBasicDataSourceMXBean- Returns:
- the maximum number of active connections
-
setMaxTotal
public void setMaxTotal(int maxTotal)
Sets the maximum total number of idle and borrows connections that can be active at the same time. Use a negative value for no limit.- Parameters:
maxTotal- the new value for maxTotal- See Also:
getMaxTotal()
-
getMaxIdle
public int getMaxIdle()
Returns the maximum number of connections that can remain idle in the pool. Excess idle connections are destroyed on return to the pool.
A negative value indicates that there is no limit
- Specified by:
getMaxIdlein interfaceBasicDataSourceMXBean- Returns:
- the maximum number of idle connections
-
setMaxIdle
public void setMaxIdle(int maxIdle)
Sets the maximum number of connections that can remain idle in the pool. Excess idle connections are destroyed on return to the pool.- Parameters:
maxIdle- the new value for maxIdle- See Also:
getMaxIdle()
-
getMinIdle
public int getMinIdle()
Returns the minimum number of idle connections in the pool. The pool attempts to ensure that minIdle connections are available when the idle object evictor runs. The value of this property has no effect unlesstimeBetweenEvictionRunsMillishas a positive value.- Specified by:
getMinIdlein interfaceBasicDataSourceMXBean- Returns:
- the minimum number of idle connections
- See Also:
GenericObjectPool.getMinIdle()
-
setMinIdle
public void setMinIdle(int minIdle)
Sets the minimum number of idle connections in the pool. The pool attempts to ensure that minIdle connections are available when the idle object evictor runs. The value of this property has no effect unlesstimeBetweenEvictionRunsMillishas a positive value.- Parameters:
minIdle- the new value for minIdle- See Also:
GenericObjectPool.setMinIdle(int)
-
getInitialSize
public int getInitialSize()
Returns the initial size of the connection pool.- Specified by:
getInitialSizein interfaceBasicDataSourceMXBean- Returns:
- the number of connections created when the pool is initialized
-
setInitialSize
public void setInitialSize(int initialSize)
Sets the initial size of the connection pool.
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
initialSize- the number of connections created when the pool is initialized
-
getMaxWaitMillis
public long getMaxWaitMillis()
Returns the maximum number of milliseconds that the pool will wait for a connection to be returned before throwing an exception. A value less than or equal to zero means the pool is set to wait indefinitely.- Specified by:
getMaxWaitMillisin interfaceBasicDataSourceMXBean- Returns:
- the maxWaitMillis property value
-
setMaxWaitMillis
public void setMaxWaitMillis(long maxWaitMillis)
Sets the MaxWaitMillis property. Use -1 to make the pool wait indefinitely.- Parameters:
maxWaitMillis- the new value for MaxWaitMillis- See Also:
getMaxWaitMillis()
-
isPoolPreparedStatements
public boolean isPoolPreparedStatements()
Returns true if we are pooling statements.- Specified by:
isPoolPreparedStatementsin interfaceBasicDataSourceMXBean- Returns:
- true if prepared and callable statements are pooled
-
setPoolPreparedStatements
public void setPoolPreparedStatements(boolean poolingStatements)
Sets whether to pool statements or not.
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
poolingStatements- pooling on or off
-
getMaxOpenPreparedStatements
public int getMaxOpenPreparedStatements()
Gets the value of themaxOpenPreparedStatementsproperty.- Specified by:
getMaxOpenPreparedStatementsin interfaceBasicDataSourceMXBean- Returns:
- the maximum number of open statements
-
setMaxOpenPreparedStatements
public void setMaxOpenPreparedStatements(int maxOpenStatements)
Sets the value of the
maxOpenPreparedStatementsproperty.Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
maxOpenStatements- the new maximum number of prepared statements
-
getTestOnCreate
public boolean getTestOnCreate()
Returns thetestOnCreateproperty.- Specified by:
getTestOnCreatein interfaceBasicDataSourceMXBean- Returns:
- true if objects are validated immediately after they are created by the pool
- See Also:
testOnCreate
-
setTestOnCreate
public void setTestOnCreate(boolean testOnCreate)
Sets thetestOnCreateproperty. This property determines whether or not the pool will validate objects immediately after they are created by the pool- Parameters:
testOnCreate- new value for testOnCreate property
-
getTestOnBorrow
public boolean getTestOnBorrow()
Returns thetestOnBorrowproperty.- Specified by:
getTestOnBorrowin interfaceBasicDataSourceMXBean- Returns:
- true if objects are validated before being borrowed from the pool
- See Also:
testOnBorrow
-
setTestOnBorrow
public void setTestOnBorrow(boolean testOnBorrow)
Sets thetestOnBorrowproperty. This property determines whether or not the pool will validate objects before they are borrowed from the pool.- Parameters:
testOnBorrow- new value for testOnBorrow property
-
getTestOnReturn
public boolean getTestOnReturn()
Returns the value of thetestOnReturnproperty.- Returns:
- true if objects are validated before being returned to the pool
- See Also:
testOnReturn
-
setTestOnReturn
public void setTestOnReturn(boolean testOnReturn)
Sets thetestOnReturnproperty. This property determines whether or not the pool will validate objects before they are returned to the pool.- Parameters:
testOnReturn- new value for testOnReturn property
-
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis()
Returns the value of thetimeBetweenEvictionRunsMillisproperty.- Specified by:
getTimeBetweenEvictionRunsMillisin interfaceBasicDataSourceMXBean- Returns:
- the time (in milliseconds) between evictor runs
- See Also:
timeBetweenEvictionRunsMillis
-
setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
Sets thetimeBetweenEvictionRunsMillisproperty.- Parameters:
timeBetweenEvictionRunsMillis- the new time between evictor runs- See Also:
timeBetweenEvictionRunsMillis
-
getNumTestsPerEvictionRun
public int getNumTestsPerEvictionRun()
Returns the value of thenumTestsPerEvictionRunproperty.- Specified by:
getNumTestsPerEvictionRunin interfaceBasicDataSourceMXBean- Returns:
- the number of objects to examine during idle object evictor runs
- See Also:
numTestsPerEvictionRun
-
setNumTestsPerEvictionRun
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
Sets the value of thenumTestsPerEvictionRunproperty.- Parameters:
numTestsPerEvictionRun- the newnumTestsPerEvictionRunvalue- See Also:
numTestsPerEvictionRun
-
getMinEvictableIdleTimeMillis
public long getMinEvictableIdleTimeMillis()
Returns theminEvictableIdleTimeMillisproperty.- Specified by:
getMinEvictableIdleTimeMillisin interfaceBasicDataSourceMXBean- Returns:
- the value of the
minEvictableIdleTimeMillisproperty - See Also:
minEvictableIdleTimeMillis
-
setMinEvictableIdleTimeMillis
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
Sets theminEvictableIdleTimeMillisproperty.- Parameters:
minEvictableIdleTimeMillis- the minimum amount of time an object may sit idle in the pool- See Also:
minEvictableIdleTimeMillis
-
setSoftMinEvictableIdleTimeMillis
public void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis)
Sets the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.- Parameters:
softMinEvictableIdleTimeMillis- minimum amount of time a connection may sit idle in the pool before it is eligible for eviction, assuming there are minIdle idle connections in the pool.- See Also:
getSoftMinEvictableIdleTimeMillis()
-
getSoftMinEvictableIdleTimeMillis
public long getSoftMinEvictableIdleTimeMillis()
Returns the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.
When
miniEvictableIdleTimeMillisis set to a positive value, miniEvictableIdleTimeMillis is examined first by the idle connection evictor - i.e. when idle connections are visited by the evictor, idle time is first compared againstminEvictableIdleTimeMillis(without considering the number of idle connections in the pool) and then againstsoftMinEvictableIdleTimeMillis, including theminIdle, constraint.- Specified by:
getSoftMinEvictableIdleTimeMillisin interfaceBasicDataSourceMXBean- Returns:
- minimum amount of time a connection may sit idle in the pool before it is eligible for eviction, assuming there are minIdle idle connections in the pool
-
getEvictionPolicyClassName
public java.lang.String getEvictionPolicyClassName()
Gets the EvictionPolicy implementation in use with this connection pool.
-
setEvictionPolicyClassName
public void setEvictionPolicyClassName(java.lang.String evictionPolicyClassName)
Sets the EvictionPolicy implementation to use with this connection pool.- Parameters:
evictionPolicyClassName- The fully qualified class name of the EvictionPolicy implementation
-
getTestWhileIdle
public boolean getTestWhileIdle()
Returns the value of thetestWhileIdleproperty.- Specified by:
getTestWhileIdlein interfaceBasicDataSourceMXBean- Returns:
- true if objects examined by the idle object evictor are validated
- See Also:
testWhileIdle
-
setTestWhileIdle
public void setTestWhileIdle(boolean testWhileIdle)
Sets thetestWhileIdleproperty. This property determines whether or not the idle object evictor will validate connections.- Parameters:
testWhileIdle- new value for testWhileIdle property
-
getNumActive
public int getNumActive()
[Read Only] The current number of active connections that have been allocated from this data source.- Specified by:
getNumActivein interfaceBasicDataSourceMXBean- Returns:
- the current number of active connections
-
getNumIdle
public int getNumIdle()
[Read Only] The current number of idle connections that are waiting to be allocated from this data source.- Specified by:
getNumIdlein interfaceBasicDataSourceMXBean- Returns:
- the current number of idle connections
-
getPassword
public java.lang.String getPassword()
Returns the password passed to the JDBC driver to establish connections.- Specified by:
getPasswordin interfaceBasicDataSourceMXBean- Returns:
- the connection password
-
setPassword
public void setPassword(java.lang.String password)
Sets the
password.Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
password- new value for the password
-
getUrl
public java.lang.String getUrl()
Returns the JDBC connectionurlproperty.- Specified by:
getUrlin interfaceBasicDataSourceMXBean- Returns:
- the
urlpassed to the JDBC driver to establish connections
-
setUrl
public void setUrl(java.lang.String url)
Sets the
url.Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
url- the new value for the JDBC connection url
-
getUsername
public java.lang.String getUsername()
Returns the JDBC connectionusernameproperty.- Specified by:
getUsernamein interfaceBasicDataSourceMXBean- Returns:
- the
usernamepassed to the JDBC driver to establish connections
-
setUsername
public void setUsername(java.lang.String username)
Sets the
username.Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
username- the new value for the JDBC connection username
-
getValidationQuery
public java.lang.String getValidationQuery()
Returns the validation query used to validate connections before returning them.- Specified by:
getValidationQueryin interfaceBasicDataSourceMXBean- Returns:
- the SQL validation query
- See Also:
validationQuery
-
setValidationQuery
public void setValidationQuery(java.lang.String validationQuery)
Sets the
validationQuery.Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
validationQuery- the new value for the validation query
-
getValidationQueryTimeout
public int getValidationQueryTimeout()
Returns the validation query timeout.- Specified by:
getValidationQueryTimeoutin interfaceBasicDataSourceMXBean- Returns:
- the timeout in seconds before connection validation queries fail.
-
setValidationQueryTimeout
public void setValidationQueryTimeout(int timeout)
Sets the validation query timeout, the amount of time, in seconds, that connection validation will wait for a response from the database when executing a validation query. Use a value less than or equal to 0 for no timeout.Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
timeout- new validation query timeout value in seconds
-
getConnectionInitSqls
public java.util.List<java.lang.String> getConnectionInitSqls()
Returns the list of SQL statements executed when a physical connection is first created. Returns an empty list if there are no initialization statements configured.- Returns:
- initialization SQL statements
-
getConnectionInitSqlsAsArray
public java.lang.String[] getConnectionInitSqlsAsArray()
Provides the same data asgetConnectionInitSqls()but in an array so it is accessible via JMX.- Specified by:
getConnectionInitSqlsAsArrayin interfaceBasicDataSourceMXBean- Returns:
getConnectionInitSqlsAsArray()
-
setConnectionInitSqls
public void setConnectionInitSqls(java.util.Collection<java.lang.String> connectionInitSqls)
Sets the list of SQL statements to be executed when a physical connection is first created.Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
connectionInitSqls- Collection of SQL statements to execute on connection creation
-
isAccessToUnderlyingConnectionAllowed
public boolean isAccessToUnderlyingConnectionAllowed()
Returns the value of the accessToUnderlyingConnectionAllowed property.- Specified by:
isAccessToUnderlyingConnectionAllowedin interfaceBasicDataSourceMXBean- Returns:
- true if access to the underlying connection is allowed, false otherwise.
-
setAccessToUnderlyingConnectionAllowed
public void setAccessToUnderlyingConnectionAllowed(boolean allow)
Sets the value of the accessToUnderlyingConnectionAllowed property. It controls if the PoolGuard allows access to the underlying connection. (Default: false)
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
allow- Access to the underlying connection is granted when true.
-
getMaxConnLifetimeMillis
public long getMaxConnLifetimeMillis()
Returns the maximum permitted lifetime of a connection in milliseconds. A value of zero or less indicates an infinite lifetime.- Specified by:
getMaxConnLifetimeMillisin interfaceBasicDataSourceMXBean- Returns:
getMaxConnLifetimeMillis()
-
getLogExpiredConnections
public boolean getLogExpiredConnections()
WhengetMaxConnLifetimeMillis()is set to limit connection lifetime, this property determines whether or not log messages are generated when the pool closes connections due to maximum lifetime exceeded.- Specified by:
getLogExpiredConnectionsin interfaceBasicDataSourceMXBean- Returns:
getLogExpiredConnections()- Since:
- 2.1
-
setMaxConnLifetimeMillis
public void setMaxConnLifetimeMillis(long maxConnLifetimeMillis)
Sets the maximum permitted lifetime of a connection in milliseconds. A value of zero or less indicates an infinite lifetime.
Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.
-
setLogExpiredConnections
public void setLogExpiredConnections(boolean logExpiredConnections)
WhengetMaxConnLifetimeMillis()is set to limit connection lifetime, this property determines whether or not log messages are generated when the pool closes connections due to maximum lifetime exceeded. Set this property to false to suppress log messages when connections expire.
-
getJmxName
public java.lang.String getJmxName()
Returns the JMX name that has been requested for this DataSource. If the requested name is not valid, an alternative may be chosen.
-
setJmxName
public void setJmxName(java.lang.String jmxName)
Sets the JMX name that has been requested for this DataSource. If the requested name is not valid, an alternative may be chosen. This DataSource will attempt to register itself using this name. If another component registers this DataSource with JMX and this name is valid this name will be used in preference to any specified by the other component.
-
getEnableAutoCommitOnReturn
public boolean getEnableAutoCommitOnReturn()
Returns the value of the flag that controls whether or not connections being returned to the pool will be checked and configured withConnection.setAutoCommit(true)if the auto commit setting isfalsewhen the connection is returned. It istrueby default.
-
setEnableAutoCommitOnReturn
public void setEnableAutoCommitOnReturn(boolean enableAutoCommitOnReturn)
Sets the value of the flag that controls whether or not connections being returned to the pool will be checked and configured withConnection.setAutoCommit(true)if the auto commit setting isfalsewhen the connection is returned. It istrueby default.
-
getRollbackOnReturn
public boolean getRollbackOnReturn()
Gets the current value of the flag that controls if a connection will be rolled back when it is returned to the pool if auto commit is not enabled and the connection is not read only.
-
setRollbackOnReturn
public void setRollbackOnReturn(boolean rollbackOnReturn)
Sets the flag that controls if a connection will be rolled back when it is returned to the pool if auto commit is not enabled and the connection is not read only.
-
getDisconnectionSqlCodes
public java.util.Set<java.lang.String> getDisconnectionSqlCodes()
Returns the set of SQL_STATE codes considered to signal fatal conditions.- Returns:
- fatal disconnection state codes
- Since:
- 2.1
- See Also:
setDisconnectionSqlCodes(Collection)
-
getDisconnectionSqlCodesAsArray
public java.lang.String[] getDisconnectionSqlCodesAsArray()
Provides the same data asgetDisconnectionSqlCodes()but in an array so it is accessible via JMX.- Specified by:
getDisconnectionSqlCodesAsArrayin interfaceBasicDataSourceMXBean- Returns:
getDisconnectionSqlCodesAsArray()- Since:
- 2.1
-
setDisconnectionSqlCodes
public void setDisconnectionSqlCodes(java.util.Collection<java.lang.String> disconnectionSqlCodes)
Sets the SQL_STATE codes considered to signal fatal conditions.Overrides the defaults in
Utils.DISCONNECTION_SQL_CODES(plus anything starting withUtils.DISCONNECTION_SQL_CODE_PREFIX). If this property is non-null andgetFastFailValidation()istrue, whenever connections created by this datasource generate exceptions with SQL_STATE codes in this list, they will be marked as "fatally disconnected" and subsequent validations will fail fast (no attempt at isValid or validation query).If
getFastFailValidation()isfalsesetting this property has no effect.Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked:
getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.- Parameters:
disconnectionSqlCodes- SQL_STATE codes considered to signal fatal conditions- Since:
- 2.1
-
getFastFailValidation
public boolean getFastFailValidation()
True means that validation will fail immediately for connections that have previously thrown SQLExceptions with SQL_STATE indicating fatal disconnection errors.- Specified by:
getFastFailValidationin interfaceBasicDataSourceMXBean- Returns:
- true if connections created by this datasource will fast fail validation.
- Since:
- 2.1
- See Also:
setDisconnectionSqlCodes(Collection)
-
setFastFailValidation
public void setFastFailValidation(boolean fastFailValidation)
- Parameters:
fastFailValidation- true means connections created by this factory will fast fail validation- Since:
- 2.1
- See Also:
getFastFailValidation()
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLExceptionCreate (if necessary) and return a connection to the database.- Specified by:
getConnectionin interfacejavax.sql.DataSource- Returns:
- a database connection
- Throws:
java.sql.SQLException- if a database access error occurs
-
getConnection
public java.sql.Connection getConnection(java.lang.String user, java.lang.String pass) throws java.sql.SQLExceptionBasicDataSource does NOT support this method.- Specified by:
getConnectionin interfacejavax.sql.DataSource- Parameters:
user- Database user on whose behalf the Connection is being madepass- The database user's password- Returns:
- nothing - always throws UnsupportedOperationException
- Throws:
java.lang.UnsupportedOperationExceptionjava.sql.SQLException- if a database access error occurs
-
getLoginTimeout
public int getLoginTimeout() throws java.sql.SQLExceptionBasicDataSource does NOT support this method.Returns the login timeout (in seconds) for connecting to the database.
Calls
createDataSource(), so has the side effect of initializing the connection pool.- Specified by:
getLoginTimeoutin interfacejavax.sql.CommonDataSource- Specified by:
getLoginTimeoutin interfacejavax.sql.DataSource- Returns:
- login timeout in seconds
- Throws:
java.sql.SQLException- if a database access error occursjava.lang.UnsupportedOperationException- If the DataSource implementation does not support the login timeout feature.
-
getLogWriter
public java.io.PrintWriter getLogWriter() throws java.sql.SQLExceptionReturns the log writer being used by this data source.
Calls
createDataSource(), so has the side effect of initializing the connection pool.- Specified by:
getLogWriterin interfacejavax.sql.CommonDataSource- Specified by:
getLogWriterin interfacejavax.sql.DataSource- Returns:
- log writer in use
- Throws:
java.sql.SQLException- if a database access error occurs
-
setLoginTimeout
public void setLoginTimeout(int loginTimeout) throws java.sql.SQLExceptionBasicDataSource does NOT support this method.Set the login timeout (in seconds) for connecting to the database.
Calls
createDataSource(), so has the side effect of initializing the connection pool.- Specified by:
setLoginTimeoutin interfacejavax.sql.CommonDataSource- Specified by:
setLoginTimeoutin interfacejavax.sql.DataSource- Parameters:
loginTimeout- The new login timeout, or zero for no timeout- Throws:
java.lang.UnsupportedOperationException- If the DataSource implementation does not support the login timeout feature.java.sql.SQLException- if a database access error occurs
-
setLogWriter
public void setLogWriter(java.io.PrintWriter logWriter) throws java.sql.SQLExceptionSets the log writer being used by this data source.
Calls
createDataSource(), so has the side effect of initializing the connection pool.- Specified by:
setLogWriterin interfacejavax.sql.CommonDataSource- Specified by:
setLogWriterin interfacejavax.sql.DataSource- Parameters:
logWriter- The new log writer- Throws:
java.sql.SQLException- if a database access error occurs
-
getRemoveAbandonedOnBorrow
public boolean getRemoveAbandonedOnBorrow()
Flag to remove abandoned connections if they exceed the removeAbandonedTimeout when borrowObject is invoked.
The default value is false.
If set to true a connection is considered abandoned and eligible for removal if it has not been used for more than
removeAbandonedTimeoutseconds.Abandoned connections are identified and removed when
getConnection()is invoked and all of the following conditions hold:- Specified by:
getRemoveAbandonedOnBorrowin interfaceBasicDataSourceMXBean- Returns:
getRemoveAbandonedOnBorrow()- See Also:
getRemoveAbandonedTimeout()
-
setRemoveAbandonedOnMaintenance
public void setRemoveAbandonedOnMaintenance(boolean removeAbandonedOnMaintenance)
- Parameters:
removeAbandonedOnMaintenance- true means abandoned connections may be removed on pool maintenance.- See Also:
getRemoveAbandonedOnMaintenance()
-
getRemoveAbandonedOnMaintenance
public boolean getRemoveAbandonedOnMaintenance()
Flag to remove abandoned connections if they exceed the removeAbandonedTimeout during pool maintenance.
The default value is false.
If set to true a connection is considered abandoned and eligible for removal if it has not been used for more than
removeAbandonedTimeoutseconds.- Specified by:
getRemoveAbandonedOnMaintenancein interfaceBasicDataSourceMXBean- Returns:
getRemoveAbandonedOnMaintenance()- See Also:
getRemoveAbandonedTimeout()
-
setRemoveAbandonedOnBorrow
public void setRemoveAbandonedOnBorrow(boolean removeAbandonedOnBorrow)
- Parameters:
removeAbandonedOnBorrow- true means abandoned connections may be removed when connections are borrowed from the pool.- See Also:
getRemoveAbandonedOnBorrow()
-
getRemoveAbandonedTimeout
public int getRemoveAbandonedTimeout()
Timeout in seconds before an abandoned connection can be removed.
Creating a Statement, PreparedStatement or CallableStatement or using one of these to execute a query (using one of the execute methods) resets the lastUsed property of the parent connection.
Abandoned connection cleanup happens when:
getRemoveAbandonedOnBorrow()orgetRemoveAbandonedOnMaintenance()= truenumIdle< 2numActive>maxTotal- 3
The default value is 300 seconds.
- Specified by:
getRemoveAbandonedTimeoutin interfaceBasicDataSourceMXBean- Returns:
getRemoveAbandonedTimeout()
-
setRemoveAbandonedTimeout
public void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
Sets the timeout in seconds before an abandoned connection can be removed.
Setting this property has no effect if
getRemoveAbandonedOnBorrow()andgetRemoveAbandonedOnMaintenance()are false.- Parameters:
removeAbandonedTimeout- new abandoned timeout in seconds- See Also:
getRemoveAbandonedTimeout(),getRemoveAbandonedOnBorrow(),getRemoveAbandonedOnMaintenance()
-
getLogAbandoned
public boolean getLogAbandoned()
Flag to log stack traces for application code which abandoned a Statement or Connection.
Defaults to false.
Logging of abandoned Statements and Connections adds overhead for every Connection open or new Statement because a stack trace has to be generated.
- Specified by:
getLogAbandonedin interfaceBasicDataSourceMXBean- Returns:
getLogAbandoned()
-
setLogAbandoned
public void setLogAbandoned(boolean logAbandoned)
- Parameters:
logAbandoned- new logAbandoned property value
-
getAbandonedLogWriter
public java.io.PrintWriter getAbandonedLogWriter()
Gets the log writer to be used by this configuration to log information on abandoned objects.
-
setAbandonedLogWriter
public void setAbandonedLogWriter(java.io.PrintWriter logWriter)
Sets the log writer to be used by this configuration to log information on abandoned objects.- Parameters:
logWriter- The new log writer
-
getAbandonedUsageTracking
public boolean getAbandonedUsageTracking()
If the connection pool implementsUsageTracking, should the connection pool record a stack trace every time a method is called on a pooled connection and retain the most recent stack trace to aid debugging of abandoned connections?- Specified by:
getAbandonedUsageTrackingin interfaceBasicDataSourceMXBean- Returns:
trueif usage tracking is enabled
-
setAbandonedUsageTracking
public void setAbandonedUsageTracking(boolean usageTracking)
If the connection pool implementsUsageTracking, configure whether the connection pool should record a stack trace every time a method is called on a pooled connection and retain the most recent stack trace to aid debugging of abandoned connections.- Parameters:
usageTracking- A value oftruewill enable the recording of a stack trace on every use of a pooled connection
-
addConnectionProperty
public void addConnectionProperty(java.lang.String name, java.lang.String value)Add a custom connection property to the set that will be passed to our JDBC driver. This MUST be called before the first connection is retrieved (along with all the other configuration property setters). Calls to this method after the connection pool has been initialized have no effect.- Parameters:
name- Name of the custom connection propertyvalue- Value of the custom connection property
-
removeConnectionProperty
public void removeConnectionProperty(java.lang.String name)
Remove a custom connection property.- Parameters:
name- Name of the custom connection property to remove- See Also:
addConnectionProperty(String, String)
-
setConnectionProperties
public void setConnectionProperties(java.lang.String connectionProperties)
Sets the connection properties passed to driver.connect(...). Format of the string must be [propertyName=property;]* NOTE - The "user" and "password" properties will be added explicitly, so they do not need to be included here.- Parameters:
connectionProperties- the connection properties used to create new connections
-
close
public void close() throws java.sql.SQLExceptionCloses and releases all idle connections that are currently stored in the connection pool associated with this data source.
Connections that are checked out to clients when this method is invoked are not affected. When client applications subsequently invoke
Connection.close()to return these connections to the pool, the underlying JDBC connections are closed.Attempts to acquire connections using
getConnection()after this method has been invoked result in SQLExceptions.This method is idempotent - i.e., closing an already closed BasicDataSource has no effect and does not generate exceptions.
- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.sql.SQLException- if an error occurs closing idle connections
-
isClosed
public boolean isClosed()
If true, this data source is closed and no more connections can be retrieved from this datasource.- Specified by:
isClosedin interfaceBasicDataSourceMXBean- Returns:
- true, if the data source is closed; false otherwise
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
getParentLogger
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException- Specified by:
getParentLoggerin interfacejavax.sql.CommonDataSource- Throws:
java.sql.SQLFeatureNotSupportedException
-
invalidateConnection
public void invalidateConnection(java.sql.Connection connection) throws java.lang.IllegalStateExceptionManually invalidates a connection, effectively requesting the pool to try to close it, remove it from the pool and reclaim pool capacity.- Throws:
java.lang.IllegalStateException- if invalidating the connection failed.- Since:
- 2.1
-
preRegister
public javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)- Specified by:
preRegisterin interfacejavax.management.MBeanRegistration
-
postRegister
public void postRegister(java.lang.Boolean registrationDone)
- Specified by:
postRegisterin interfacejavax.management.MBeanRegistration
-
preDeregister
public void preDeregister() throws java.lang.Exception- Specified by:
preDeregisterin interfacejavax.management.MBeanRegistration- Throws:
java.lang.Exception
-
postDeregister
public void postDeregister()
- Specified by:
postDeregisterin interfacejavax.management.MBeanRegistration
-
-