Class PoolableConnectionFactory
- java.lang.Object
-
- org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory
-
- All Implemented Interfaces:
PooledObjectFactory<PoolableConnection>
- Direct Known Subclasses:
PoolableManagedConnectionFactory
public class PoolableConnectionFactory extends java.lang.Object implements PooledObjectFactory<PoolableConnection>
APooledObjectFactory
that createsPoolableConnection
s.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description PoolableConnectionFactory(ConnectionFactory connFactory, javax.management.ObjectName dataSourceJmxObjectName)
Creates a newPoolableConnectionFactory
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
activateObject(PooledObject<PoolableConnection> p)
Reinitializes an instance to be returned by the pool.void
destroyObject(PooledObject<PoolableConnection> p)
Destroys an instance no longer needed by the pool, using the default (NORMAL) DestroyMode.void
destroyObject(PooledObject<PoolableConnection> p, DestroyMode mode)
Destroys an instance no longer needed by the pool, using the provided DestroyMode.boolean
getCacheState()
Gets the cache state to propagate inmakeObject()
.ConnectionFactory
getConnectionFactory()
Gets the connection factory.protected java.util.concurrent.atomic.AtomicLong
getConnectionIndex()
Gets how many connections were created inmakeObject()
.java.util.Collection<java.lang.String>
getConnectionInitSqls()
Gets the collection of initialization SQL statements.javax.management.ObjectName
getDataSourceJmxName()
Gets data source JMX ObjectName.javax.management.ObjectName
getDataSourceJmxObjectName()
Gets the data source JMX ObjectName.java.lang.Boolean
getDefaultAutoCommit()
Gets the Default auto-commit value.java.lang.String
getDefaultCatalog()
Gets the default catalog.java.lang.Integer
getDefaultQueryTimeout()
Deprecated.java.time.Duration
getDefaultQueryTimeoutDuration()
Gets the default query timeout Duration.java.lang.Integer
getDefaultQueryTimeoutSeconds()
Deprecated.java.lang.Boolean
getDefaultReadOnly()
Gets the default read-only-value.java.lang.String
getDefaultSchema()
Gets the default schema.int
getDefaultTransactionIsolation()
Gets the default transaction isolation.java.util.Collection<java.lang.String>
getDisconnectionIgnoreSqlCodes()
Gets the collection of SQL State codes that are not considered fatal disconnection codes.java.util.Collection<java.lang.String>
getDisconnectionSqlCodes()
Gets SQL State codes considered to signal fatal conditions.java.time.Duration
getMaxConnDuration()
Gets the Maximum connection duration.long
getMaxConnLifetimeMillis()
Gets the Maximum connection lifetime in milliseconds.protected int
getMaxOpenPreparedStatements()
Gets the maximum number of open prepared statements.ObjectPool<PoolableConnection>
getPool()
Returns theObjectPool
in whichConnection
s are pooled.boolean
getPoolStatements()
Tests whether to pool statements.java.lang.String
getValidationQuery()
Gets the validation query.java.time.Duration
getValidationQueryTimeoutDuration()
Gets the query timeout in seconds.int
getValidationQueryTimeoutSeconds()
Deprecated.protected void
initializeConnection(java.sql.Connection conn)
Initializes the given connection with the collection of SQL statements set insetConnectionInitSql(Collection)
.boolean
isAutoCommitOnReturn()
Tests whether to set auto-commit onpassivateObject(PooledObject)
.boolean
isEnableAutoCommitOnReturn()
Deprecated.boolean
isFastFailValidation()
True means that validation will fail immediately for connections that have previously thrown SQLExceptions with SQL State indicating fatal disconnection errors.boolean
isRollbackOnReturn()
Tests whether to rollback on return.PooledObject<PoolableConnection>
makeObject()
Creates an instance that can be served by the pool and wrap it in aPooledObject
to be managed by the pool.void
passivateObject(PooledObject<PoolableConnection> p)
Uninitializes an instance to be returned to the idle object pool.void
setAutoCommitOnReturn(boolean autoCommitOnReturn)
Sets whether to set auto-commit onpassivateObject(PooledObject)
.void
setCacheState(boolean cacheState)
Sets the cache state to propagate inmakeObject()
.void
setClearStatementPoolOnReturn(boolean clearStatementPoolOnReturn)
Sets whether the pool of statements (which was enabled withsetPoolStatements(boolean)
) should be cleared when the connection is returned to its pool.void
setConnectionInitSql(java.util.Collection<java.lang.String> connectionInitSqls)
Sets the SQL statements I use to initialize newly createdConnection
s.void
setDefaultAutoCommit(java.lang.Boolean defaultAutoCommit)
Sets the default "auto commit" setting for borrowedConnection
svoid
setDefaultCatalog(java.lang.String defaultCatalog)
Sets the default "catalog" setting for borrowedConnection
svoid
setDefaultQueryTimeout(java.lang.Integer defaultQueryTimeoutSeconds)
Deprecated.void
setDefaultQueryTimeout(java.time.Duration defaultQueryTimeoutDuration)
Sets the query timeout Duration.void
setDefaultReadOnly(java.lang.Boolean defaultReadOnly)
Sets the default "read only" setting for borrowedConnection
svoid
setDefaultSchema(java.lang.String defaultSchema)
Sets the default "schema" setting for borrowedConnection
svoid
setDefaultTransactionIsolation(int defaultTransactionIsolation)
Sets the default "Transaction Isolation" setting for borrowedConnection
svoid
setDisconnectionIgnoreSqlCodes(java.util.Collection<java.lang.String> disconnectionIgnoreSqlCodes)
Sets the disconnection SQL codes to ignore.void
setDisconnectionSqlCodes(java.util.Collection<java.lang.String> disconnectionSqlCodes)
Sets the disconnection SQL codes.void
setEnableAutoCommitOnReturn(boolean autoCommitOnReturn)
Deprecated.void
setFastFailValidation(boolean fastFailValidation)
void
setMaxConn(java.time.Duration maxConnDuration)
Sets the maximum lifetime in milliseconds of a connection after which the connection will always fail activation, passivation and validation.void
setMaxConnLifetimeMillis(long maxConnLifetimeMillis)
Deprecated.UsesetMaxConn(Duration)
.void
setMaxOpenPreparedStatements(int maxOpenPreparedStatements)
Sets the maximum number of open prepared statements.void
setMaxOpenPrepatedStatements(int maxOpenPreparedStatements)
Deprecated.void
setPool(ObjectPool<PoolableConnection> pool)
Sets theObjectPool
in which to poolConnection
s.void
setPoolStatements(boolean poolStatements)
Sets whether to pool statements.void
setRollbackOnReturn(boolean rollbackOnReturn)
Sets whether to rollback on return.void
setValidationQuery(java.lang.String validationQuery)
Sets the query I use tovalidate
Connection
s.void
setValidationQueryTimeout(int validationQueryTimeoutSeconds)
Deprecated.void
setValidationQueryTimeout(java.time.Duration validationQueryTimeoutDuration)
Sets the validation query timeout, the amount of time, that connection validation will wait for a response from the database when executing a validation query.void
validateConnection(PoolableConnection conn)
Validates the given connection if it is open.boolean
validateObject(PooledObject<PoolableConnection> p)
Ensures that the instance is safe to be returned by the pool.
-
-
-
Constructor Detail
-
PoolableConnectionFactory
public PoolableConnectionFactory(ConnectionFactory connFactory, javax.management.ObjectName dataSourceJmxObjectName)
Creates a newPoolableConnectionFactory
.- Parameters:
connFactory
- theConnectionFactory
from which to obtain baseConnection
sdataSourceJmxObjectName
- The JMX object name, may be null.
-
-
Method Detail
-
activateObject
public void activateObject(PooledObject<PoolableConnection> p) throws java.sql.SQLException
Description copied from interface:PooledObjectFactory
Reinitializes an instance to be returned by the pool.- Specified by:
activateObject
in interfacePooledObjectFactory<PoolableConnection>
- Parameters:
p
- aPooledObject
wrapping the instance to be activated- Throws:
java.sql.SQLException
- See Also:
PooledObjectFactory.destroyObject(org.apache.tomcat.dbcp.pool2.PooledObject<T>)
-
destroyObject
public void destroyObject(PooledObject<PoolableConnection> p) throws java.sql.SQLException
Description copied from interface:PooledObjectFactory
Destroys an instance no longer needed by the pool, using the default (NORMAL) DestroyMode.It is important for implementations of this method to be aware that there is no guarantee about what state
obj
will be in and the implementation should be prepared to handle unexpected errors.Also, an implementation must take in to consideration that instances lost to the garbage collector may never be destroyed.
- Specified by:
destroyObject
in interfacePooledObjectFactory<PoolableConnection>
- Parameters:
p
- aPooledObject
wrapping the instance to be destroyed- Throws:
java.sql.SQLException
- See Also:
PooledObjectFactory.validateObject(org.apache.tomcat.dbcp.pool2.PooledObject<T>)
,ObjectPool.invalidateObject(T)
-
destroyObject
public void destroyObject(PooledObject<PoolableConnection> p, DestroyMode mode) throws java.sql.SQLException
Description copied from interface:PooledObjectFactory
Destroys an instance no longer needed by the pool, using the provided DestroyMode.- Specified by:
destroyObject
in interfacePooledObjectFactory<PoolableConnection>
- Parameters:
p
- aPooledObject
wrapping the instance to be destroyedmode
- DestroyMode providing context to the factory- Throws:
java.sql.SQLException
- Since:
- 2.9.0
- See Also:
PooledObjectFactory.validateObject(org.apache.tomcat.dbcp.pool2.PooledObject<T>)
,ObjectPool.invalidateObject(T)
,PooledObjectFactory.destroyObject(PooledObject)
,DestroyMode
-
getCacheState
public boolean getCacheState()
Gets the cache state to propagate inmakeObject()
.- Returns:
- The cache state.
- Since:
- 2.6.0.
-
getConnectionFactory
public ConnectionFactory getConnectionFactory()
Gets the connection factory.- Returns:
- The connection factory.
- Since:
- 2.6.0.
-
getConnectionIndex
protected java.util.concurrent.atomic.AtomicLong getConnectionIndex()
Gets how many connections were created inmakeObject()
.- Returns:
- the connection count.
-
getConnectionInitSqls
public java.util.Collection<java.lang.String> getConnectionInitSqls()
Gets the collection of initialization SQL statements.- Returns:
- The collection of initialization SQL statements.
- Since:
- 2.6.0
-
getDataSourceJmxName
public javax.management.ObjectName getDataSourceJmxName()
Gets data source JMX ObjectName.- Returns:
- The data source JMX ObjectName.
- Since:
- 2.6.0.
-
getDataSourceJmxObjectName
public javax.management.ObjectName getDataSourceJmxObjectName()
Gets the data source JMX ObjectName.- Returns:
- The data source JMX ObjectName.
- Since:
- 2.6.0
-
getDefaultAutoCommit
public java.lang.Boolean getDefaultAutoCommit()
Gets the Default auto-commit value.- Returns:
- The default auto-commit value.
- Since:
- 2.6.0
-
getDefaultCatalog
public java.lang.String getDefaultCatalog()
Gets the default catalog.- Returns:
- The default catalog.
- Since:
- 2.6.0
-
getDefaultQueryTimeout
@Deprecated public java.lang.Integer getDefaultQueryTimeout()
Deprecated.Gets the default query timeout in seconds.- Returns:
- The default query timeout in seconds.
-
getDefaultQueryTimeoutDuration
public java.time.Duration getDefaultQueryTimeoutDuration()
Gets the default query timeout Duration.- Returns:
- The default query timeout Duration.
- Since:
- 2.10.0
-
getDefaultQueryTimeoutSeconds
@Deprecated public java.lang.Integer getDefaultQueryTimeoutSeconds()
Deprecated.Gets the default query timeout in seconds.- Returns:
- The default query timeout in seconds.
- Since:
- 2.6.0
-
getDefaultReadOnly
public java.lang.Boolean getDefaultReadOnly()
Gets the default read-only-value.- Returns:
- The default read-only-value.
- Since:
- 2.6.0
-
getDefaultSchema
public java.lang.String getDefaultSchema()
Gets the default schema.- Returns:
- The default schema.
- Since:
- 2.6.0
-
getDefaultTransactionIsolation
public int getDefaultTransactionIsolation()
Gets the default transaction isolation.- Returns:
- The default transaction isolation.
- Since:
- 2.6.0
-
getDisconnectionIgnoreSqlCodes
public java.util.Collection<java.lang.String> getDisconnectionIgnoreSqlCodes()
Gets the collection of SQL State codes that are not considered fatal disconnection codes.This method returns the collection of SQL State codes that have been set to be ignored when determining if a
SQLException
signals a disconnection. These codes are excluded from being treated as fatal even if they match the typical disconnection criteria.- Returns:
- a
Collection
of SQL State codes that should be ignored for disconnection checks. - Since:
- 2.13.0
-
getDisconnectionSqlCodes
public java.util.Collection<java.lang.String> getDisconnectionSqlCodes()
Gets SQL State codes considered to signal fatal conditions.Overrides the defaults in
Utils.getDisconnectionSqlCodes()
(plus anything starting withUtils.DISCONNECTION_SQL_CODE_PREFIX
). If this property is non-null andisFastFailValidation()
istrue
, whenever connections created by this factory 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
isFastFailValidation()
isfalse
setting this property has no effect.- Returns:
- SQL State codes overriding defaults
- Since:
- 2.1
-
getMaxConnDuration
public java.time.Duration getMaxConnDuration()
Gets the Maximum connection duration.- Returns:
- Maximum connection duration.
- Since:
- 2.10.0
-
getMaxConnLifetimeMillis
public long getMaxConnLifetimeMillis()
Gets the Maximum connection lifetime in milliseconds.- Returns:
- Maximum connection lifetime in milliseconds.
- Since:
- 2.6.0
-
getMaxOpenPreparedStatements
protected int getMaxOpenPreparedStatements()
Gets the maximum number of open prepared statements.- Returns:
- The maximum number of open prepared statements.
-
getPool
public ObjectPool<PoolableConnection> getPool()
Returns theObjectPool
in whichConnection
s are pooled.- Returns:
- the connection pool
-
getPoolStatements
public boolean getPoolStatements()
Tests whether to pool statements.- Returns:
- Whether to pool statements.
- Since:
- 2.6.0.
-
getValidationQuery
public java.lang.String getValidationQuery()
Gets the validation query.- Returns:
- Validation query.
- Since:
- 2.6.0
-
getValidationQueryTimeoutDuration
public java.time.Duration getValidationQueryTimeoutDuration()
Gets the query timeout in seconds.- Returns:
- Validation query timeout in seconds.
- Since:
- 2.10.0
-
getValidationQueryTimeoutSeconds
@Deprecated public int getValidationQueryTimeoutSeconds()
Deprecated.Gets the query timeout in seconds.- Returns:
- Validation query timeout in seconds.
- Since:
- 2.6.0
-
initializeConnection
protected void initializeConnection(java.sql.Connection conn) throws java.sql.SQLException
Initializes the given connection with the collection of SQL statements set insetConnectionInitSql(Collection)
.- Parameters:
conn
- the connection to initialize.- Throws:
java.sql.SQLException
- if a database access error occurs or this method is called on a closed connection.- See Also:
setConnectionInitSql(Collection)
-
isAutoCommitOnReturn
public boolean isAutoCommitOnReturn()
Tests whether to set auto-commit onpassivateObject(PooledObject)
.- Returns:
- Whether to set auto-commit on
passivateObject(PooledObject)
. - Since:
- 2.6.0
-
isEnableAutoCommitOnReturn
@Deprecated public boolean isEnableAutoCommitOnReturn()
Deprecated.Tests whether to set auto-commit onpassivateObject(PooledObject)
.- Returns:
- Whether to set auto-commit on
passivateObject(PooledObject)
.
-
isFastFailValidation
public boolean isFastFailValidation()
True means that validation will fail immediately for connections that have previously thrown SQLExceptions with SQL State indicating fatal disconnection errors.- Returns:
- true if connections created by this factory will fast fail validation.
- Since:
- 2.1, 2.5.0 Defaults to true, previous versions defaulted to false.
- See Also:
setDisconnectionSqlCodes(Collection)
-
isRollbackOnReturn
public boolean isRollbackOnReturn()
Tests whether to rollback on return.- Returns:
- Whether to rollback on return.
-
makeObject
public PooledObject<PoolableConnection> makeObject() throws java.sql.SQLException
Description copied from interface:PooledObjectFactory
Creates an instance that can be served by the pool and wrap it in aPooledObject
to be managed by the pool.- Specified by:
makeObject
in interfacePooledObjectFactory<PoolableConnection>
- Returns:
- a
PooledObject
wrapping an instance that can be served by the pool, not null. - Throws:
java.sql.SQLException
-
passivateObject
public void passivateObject(PooledObject<PoolableConnection> p) throws java.sql.SQLException
Description copied from interface:PooledObjectFactory
Uninitializes an instance to be returned to the idle object pool.- Specified by:
passivateObject
in interfacePooledObjectFactory<PoolableConnection>
- Parameters:
p
- aPooledObject
wrapping the instance to be passivated- Throws:
java.sql.SQLException
- See Also:
PooledObjectFactory.destroyObject(org.apache.tomcat.dbcp.pool2.PooledObject<T>)
-
setAutoCommitOnReturn
public void setAutoCommitOnReturn(boolean autoCommitOnReturn)
Sets whether to set auto-commit onpassivateObject(PooledObject)
.- Parameters:
autoCommitOnReturn
- whether to set auto-commit.
-
setCacheState
public void setCacheState(boolean cacheState)
Sets the cache state to propagate inmakeObject()
.- Parameters:
cacheState
- the cache state to propagate.
-
setClearStatementPoolOnReturn
public void setClearStatementPoolOnReturn(boolean clearStatementPoolOnReturn)
Sets whether the pool of statements (which was enabled withsetPoolStatements(boolean)
) should be cleared when the connection is returned to its pool. Default is false.- Parameters:
clearStatementPoolOnReturn
- clear or not- Since:
- 2.8.0
-
setConnectionInitSql
public void setConnectionInitSql(java.util.Collection<java.lang.String> connectionInitSqls)
Sets the SQL statements I use to initialize newly createdConnection
s. Usingnull
turns off connection initialization.- Parameters:
connectionInitSqls
- SQL statement to initializeConnection
s.
-
setDefaultAutoCommit
public void setDefaultAutoCommit(java.lang.Boolean defaultAutoCommit)
Sets the default "auto commit" setting for borrowedConnection
s- Parameters:
defaultAutoCommit
- the default "auto commit" setting for borrowedConnection
s
-
setDefaultCatalog
public void setDefaultCatalog(java.lang.String defaultCatalog)
Sets the default "catalog" setting for borrowedConnection
s- Parameters:
defaultCatalog
- the default "catalog" setting for borrowedConnection
s
-
setDefaultQueryTimeout
public void setDefaultQueryTimeout(java.time.Duration defaultQueryTimeoutDuration)
Sets the query timeout Duration.- Parameters:
defaultQueryTimeoutDuration
- the query timeout Duration.- Since:
- 2.10.0
-
setDefaultQueryTimeout
@Deprecated public void setDefaultQueryTimeout(java.lang.Integer defaultQueryTimeoutSeconds)
Deprecated.Sets the query timeout in seconds.- Parameters:
defaultQueryTimeoutSeconds
- the query timeout in seconds.
-
setDefaultReadOnly
public void setDefaultReadOnly(java.lang.Boolean defaultReadOnly)
Sets the default "read only" setting for borrowedConnection
s- Parameters:
defaultReadOnly
- the default "read only" setting for borrowedConnection
s
-
setDefaultSchema
public void setDefaultSchema(java.lang.String defaultSchema)
Sets the default "schema" setting for borrowedConnection
s- Parameters:
defaultSchema
- the default "schema" setting for borrowedConnection
s- Since:
- 2.5.0
-
setDefaultTransactionIsolation
public void setDefaultTransactionIsolation(int defaultTransactionIsolation)
Sets the default "Transaction Isolation" setting for borrowedConnection
s- Parameters:
defaultTransactionIsolation
- the default "Transaction Isolation" setting for returnedConnection
s
-
setDisconnectionIgnoreSqlCodes
public void setDisconnectionIgnoreSqlCodes(java.util.Collection<java.lang.String> disconnectionIgnoreSqlCodes)
Sets the disconnection SQL codes to ignore.- Parameters:
disconnectionIgnoreSqlCodes
- The collection of SQL State codes to be ignored.- Throws:
java.lang.IllegalArgumentException
- if any SQL state codes overlap with those indisconnectionSqlCodes
.- Since:
- 2.13.0
- See Also:
getDisconnectionIgnoreSqlCodes()
-
setDisconnectionSqlCodes
public void setDisconnectionSqlCodes(java.util.Collection<java.lang.String> disconnectionSqlCodes)
Sets the disconnection SQL codes.- Parameters:
disconnectionSqlCodes
- The disconnection SQL codes.- Throws:
java.lang.IllegalArgumentException
- if any SQL state codes overlap with those indisconnectionIgnoreSqlCodes
.- Since:
- 2.1
- See Also:
getDisconnectionSqlCodes()
-
setEnableAutoCommitOnReturn
@Deprecated public void setEnableAutoCommitOnReturn(boolean autoCommitOnReturn)
Deprecated.Sets whether to set auto-commit onpassivateObject(PooledObject)
.- Parameters:
autoCommitOnReturn
- whether to set auto-commit.
-
setFastFailValidation
public void setFastFailValidation(boolean fastFailValidation)
- Parameters:
fastFailValidation
- true means connections created by this factory will fast fail validation- Since:
- 2.1
- See Also:
isFastFailValidation()
-
setMaxConn
public void setMaxConn(java.time.Duration maxConnDuration)
Sets the maximum lifetime in milliseconds of a connection after which the connection will always fail activation, passivation and validation. A value of zero or less indicates an infinite lifetime. The default value is -1.- Parameters:
maxConnDuration
- The maximum lifetime in milliseconds.- Since:
- 2.10.0
-
setMaxConnLifetimeMillis
@Deprecated public void setMaxConnLifetimeMillis(long maxConnLifetimeMillis)
Deprecated.UsesetMaxConn(Duration)
.Sets the maximum lifetime in milliseconds of a connection after which the connection will always fail activation, passivation and validation. A value of zero or less indicates an infinite lifetime. The default value is -1.- Parameters:
maxConnLifetimeMillis
- The maximum lifetime in milliseconds.
-
setMaxOpenPreparedStatements
public void setMaxOpenPreparedStatements(int maxOpenPreparedStatements)
Sets the maximum number of open prepared statements.- Parameters:
maxOpenPreparedStatements
- The maximum number of open prepared statements.
-
setMaxOpenPrepatedStatements
@Deprecated public void setMaxOpenPrepatedStatements(int maxOpenPreparedStatements)
Deprecated.Deprecated due to typo in method name.- Parameters:
maxOpenPreparedStatements
- The maximum number of open prepared statements.
-
setPool
public void setPool(ObjectPool<PoolableConnection> pool)
Sets theObjectPool
in which to poolConnection
s.- Parameters:
pool
- theObjectPool
in which to pool thoseConnection
s
-
setPoolStatements
public void setPoolStatements(boolean poolStatements)
Sets whether to pool statements.- Parameters:
poolStatements
- whether to pool statements.
-
setRollbackOnReturn
public void setRollbackOnReturn(boolean rollbackOnReturn)
Sets whether to rollback on return.- Parameters:
rollbackOnReturn
- whether to rollback on return.
-
setValidationQuery
public void setValidationQuery(java.lang.String validationQuery)
Sets the query I use tovalidate
Connection
s. Should return at least one row. If not specified,Connection.isValid(int)
will be used to validate connections.- Parameters:
validationQuery
- a query to use tovalidate
Connection
s.
-
setValidationQueryTimeout
public void setValidationQueryTimeout(java.time.Duration validationQueryTimeoutDuration)
Sets the validation query timeout, the amount of time, 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.- Parameters:
validationQueryTimeoutDuration
- new validation query timeout duration.- Since:
- 2.10.0
-
setValidationQueryTimeout
@Deprecated public void setValidationQueryTimeout(int validationQueryTimeoutSeconds)
Deprecated.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.- Parameters:
validationQueryTimeoutSeconds
- new validation query timeout value in seconds
-
validateConnection
public void validateConnection(PoolableConnection conn) throws java.sql.SQLException
Validates the given connection if it is open.- Parameters:
conn
- the connection to validate.- Throws:
java.sql.SQLException
- if the connection is closed or validate fails.
-
validateObject
public boolean validateObject(PooledObject<PoolableConnection> p)
Description copied from interface:PooledObjectFactory
Ensures that the instance is safe to be returned by the pool.- Specified by:
validateObject
in interfacePooledObjectFactory<PoolableConnection>
- Parameters:
p
- aPooledObject
wrapping the instance to be validated- Returns:
false
ifobj
is not valid and should be dropped from the pool,true
otherwise.
-
-