public class PoolableConnectionFactory extends Object implements PoolableObjectFactory
PoolableObjectFactory that creates
PoolableConnections.| Modifier and Type | Field and Description |
|---|---|
protected AbandonedConfig |
_config
Configuration for removing abandoned connections.
|
protected Collection |
_connectionInitSqls |
protected ConnectionFactory |
_connFactory |
protected boolean |
_defaultAutoCommit |
protected String |
_defaultCatalog |
protected Boolean |
_defaultReadOnly |
protected int |
_defaultTransactionIsolation |
protected ObjectPool |
_pool |
protected KeyedObjectPoolFactory |
_stmtPoolFactory |
protected String |
_validationQuery |
protected int |
_validationQueryTimeout |
| Constructor and Description |
|---|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
boolean defaultReadOnly,
boolean defaultAutoCommit)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
boolean defaultReadOnly,
boolean defaultAutoCommit,
AbandonedConfig config)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation,
AbandonedConfig config)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation,
String defaultCatalog,
AbandonedConfig config)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
Boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation,
String defaultCatalog,
AbandonedConfig config)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
Collection connectionInitSqls,
boolean defaultReadOnly,
boolean defaultAutoCommit)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
Collection connectionInitSqls,
boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
Collection connectionInitSqls,
Boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation,
String defaultCatalog,
AbandonedConfig config)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
int validationQueryTimeout,
boolean defaultReadOnly,
boolean defaultAutoCommit)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
int validationQueryTimeout,
boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
int validationQueryTimeout,
Boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation,
String defaultCatalog,
AbandonedConfig config)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
int validationQueryTimeout,
Collection connectionInitSqls,
boolean defaultReadOnly,
boolean defaultAutoCommit)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
int validationQueryTimeout,
Collection connectionInitSqls,
boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation)
Create a new PoolableConnectionFactory.
|
PoolableConnectionFactory(ConnectionFactory connFactory,
ObjectPool pool,
KeyedObjectPoolFactory stmtPoolFactory,
String validationQuery,
int validationQueryTimeout,
Collection connectionInitSqls,
Boolean defaultReadOnly,
boolean defaultAutoCommit,
int defaultTransactionIsolation,
String defaultCatalog,
AbandonedConfig config)
Create a new PoolableConnectionFactory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activateObject(Object obj)
Reinitialize an instance to be returned by the pool.
|
void |
destroyObject(Object obj)
Destroys an instance no longer needed by the pool.
|
ObjectPool |
getPool()
Returns the
ObjectPool in which Connections are pooled. |
protected void |
initializeConnection(Connection conn) |
Object |
makeObject()
Creates an instance that can be served by the pool.
|
void |
passivateObject(Object obj)
Uninitialize an instance to be returned to the idle object pool.
|
void |
setConnectionFactory(ConnectionFactory connFactory)
Sets the
ConnectionFactory from which to obtain base Connections. |
void |
setConnectionInitSql(Collection connectionInitSqls)
Sets the SQL statements I use to initialize newly created
Connections. |
void |
setDefaultAutoCommit(boolean defaultAutoCommit)
Sets the default "auto commit" setting for borrowed
Connections |
void |
setDefaultCatalog(String defaultCatalog)
Sets the default "catalog" setting for borrowed
Connections |
void |
setDefaultReadOnly(boolean defaultReadOnly)
Sets the default "read only" setting for borrowed
Connections |
void |
setDefaultTransactionIsolation(int defaultTransactionIsolation)
Sets the default "Transaction Isolation" setting for borrowed
Connections |
void |
setPool(ObjectPool pool)
Sets the
ObjectPool in which to pool Connections. |
void |
setStatementPoolFactory(KeyedObjectPoolFactory stmtPoolFactory)
|
void |
setValidationQuery(String validationQuery)
Sets the query I use to
validate Connections. |
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.
|
void |
validateConnection(Connection conn) |
boolean |
validateObject(Object obj)
Ensures that the instance is safe to be returned by the pool.
|
protected volatile ConnectionFactory _connFactory
protected volatile String _validationQuery
protected volatile int _validationQueryTimeout
protected Collection _connectionInitSqls
protected volatile ObjectPool _pool
protected volatile KeyedObjectPoolFactory _stmtPoolFactory
protected Boolean _defaultReadOnly
protected boolean _defaultAutoCommit
protected int _defaultTransactionIsolation
protected String _defaultCatalog
protected AbandonedConfig _config
public PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned Connectionspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, Collection connectionInitSqls, boolean defaultReadOnly, boolean defaultAutoCommit)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.connectionInitSqls - a Collection of SQL statements to initialize Connections. Using null turns off initialization.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned Connectionspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, int validationQueryTimeout, boolean defaultReadOnly, boolean defaultAutoCommit)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.validationQueryTimeout - the number of seconds that validation queries will wait for database response before failing. Use a value less than or equal to 0 for no timeout.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned Connectionspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, int validationQueryTimeout, Collection connectionInitSqls, boolean defaultReadOnly, boolean defaultAutoCommit)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.validationQueryTimeout - the number of seconds that validation queries will wait for database response before failing. Use a value less than or equal to 0 for no timeout.connectionInitSqls - a Collection of SQL statements to initialize Connections. Using null turns off initialization.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned Connectionspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connectionspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, Collection connectionInitSqls, boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.connectionInitSqls - a Collection of SQL statement to initialize Connections. Using null turns off initialization.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connectionspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, int validationQueryTimeout, boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.validationQueryTimeout - the number of seconds that validation queries will wait for database response before failing. Use a value less than or equal to 0 for no timeout.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connectionspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, int validationQueryTimeout, Collection connectionInitSqls, boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.validationQueryTimeout - the number of seconds that validation queries will wait for database response before failing. Use a value less than or equal to 0 for no timeout.connectionInitSqls - a Collection of SQL statement to initialize Connections. Using null turns off initialization.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connectionspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit, AbandonedConfig config)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned Connectionsconfig - the AbandonedConfig if tracing SQL objectspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, AbandonedConfig config)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connectionsconfig - the AbandonedConfig if tracing SQL objectspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, String defaultCatalog, AbandonedConfig config)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned ConnectionsdefaultCatalog - the default "catalog" setting for returned Connectionsconfig - the AbandonedConfig if tracing SQL objectspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, Boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, String defaultCatalog, AbandonedConfig config)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned ConnectionsdefaultCatalog - the default "catalog" setting for returned Connectionsconfig - the AbandonedConfig if tracing SQL objectspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, Collection connectionInitSqls, Boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, String defaultCatalog, AbandonedConfig config)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.connectionInitSqls - a Collection of SQL statements to initialize Connections. Using null turns off initialization.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned ConnectionsdefaultCatalog - the default "catalog" setting for returned Connectionsconfig - the AbandonedConfig if tracing SQL objectspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, int validationQueryTimeout, Boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, String defaultCatalog, AbandonedConfig config)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.validationQueryTimeout - the number of seconds that validation queries will wait for database response before failing. Use a value less than or equal to 0 for no timeout.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned ConnectionsdefaultCatalog - the default "catalog" setting for returned Connectionsconfig - the AbandonedConfig if tracing SQL objectspublic PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, int validationQueryTimeout, Collection connectionInitSqls, Boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, String defaultCatalog, AbandonedConfig config)
connFactory - the ConnectionFactory from which to obtain base Connectionspool - the ObjectPool in which to pool those ConnectionsstmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement poolingvalidationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.validationQueryTimeout - the number of seconds that validation queries will wait for database response before failing. Use a value less than or equal to 0 for no timeout.connectionInitSqls - a Collection of SQL statements to initialize Connections. Using null turns off initialization.defaultReadOnly - the default "read only" setting for borrowed ConnectionsdefaultAutoCommit - the default "auto commit" setting for returned ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned ConnectionsdefaultCatalog - the default "catalog" setting for returned Connectionsconfig - the AbandonedConfig if tracing SQL objectspublic void setConnectionFactory(ConnectionFactory connFactory)
ConnectionFactory from which to obtain base Connections.connFactory - the ConnectionFactory from which to obtain base Connectionspublic void setValidationQuery(String validationQuery)
validate Connections.
Should return at least one row.
Using null turns off validation.validationQuery - a query to use to validate Connections.public void setValidationQueryTimeout(int timeout)
timeout - new validation query timeout value in secondspublic void setConnectionInitSql(Collection connectionInitSqls)
Connections.
Using null turns off connection initialization.connectionInitSqls - SQL statement to initialize Connections.public void setPool(ObjectPool pool)
ObjectPool in which to pool Connections.pool - the ObjectPool in which to pool those Connectionspublic ObjectPool getPool()
ObjectPool in which Connections are pooled.public void setStatementPoolFactory(KeyedObjectPoolFactory stmtPoolFactory)
KeyedObjectPoolFactory I use to create KeyedObjectPools
for pooling PreparedStatements.
Set to null to disable PreparedStatement pooling.stmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatementspublic void setDefaultReadOnly(boolean defaultReadOnly)
ConnectionsdefaultReadOnly - the default "read only" setting for borrowed Connectionspublic void setDefaultAutoCommit(boolean defaultAutoCommit)
ConnectionsdefaultAutoCommit - the default "auto commit" setting for borrowed Connectionspublic void setDefaultTransactionIsolation(int defaultTransactionIsolation)
ConnectionsdefaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connectionspublic void setDefaultCatalog(String defaultCatalog)
ConnectionsdefaultCatalog - the default "catalog" setting for borrowed Connectionspublic Object makeObject() throws Exception
PoolableObjectFactoryactivated. They will not be
activated before being served by the pool.makeObject in interface PoolableObjectFactoryException - if there is a problem creating a new instance,
this will be propagated to the code requesting an object.protected void initializeConnection(Connection conn) throws SQLException
SQLExceptionpublic void destroyObject(Object obj) throws Exception
PoolableObjectFactory
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.
destroyObject in interface PoolableObjectFactoryobj - the instance to be destroyedException - should be avoided as it may be swallowed by
the pool implementation.PoolableObjectFactory.validateObject(java.lang.Object),
ObjectPool.invalidateObject(java.lang.Object)public boolean validateObject(Object obj)
PoolableObjectFactoryfalse if obj should be destroyed.validateObject in interface PoolableObjectFactoryobj - the instance to be validatedfalse if obj is not valid and should
be dropped from the pool, true otherwise.public void validateConnection(Connection conn) throws SQLException
SQLExceptionpublic void passivateObject(Object obj) throws Exception
PoolableObjectFactorypassivateObject in interface PoolableObjectFactoryobj - the instance to be passivatedException - if there is a problem passivating obj,
this exception may be swallowed by the pool.PoolableObjectFactory.destroyObject(java.lang.Object)public void activateObject(Object obj) throws Exception
PoolableObjectFactoryactivateObject in interface PoolableObjectFactoryobj - the instance to be activatedException - if there is a problem activating obj,
this exception may be swallowed by the pool.PoolableObjectFactory.destroyObject(java.lang.Object)Copyright © 2015. All rights reserved.