Package com.adaptris.core.jdbc
Class PluggableJdbcPooledConnection
- java.lang.Object
-
- com.adaptris.core.AdaptrisConnectionImp
-
- com.adaptris.core.AllowsRetriesConnection
-
- com.adaptris.core.jdbc.DatabaseConnection
-
- com.adaptris.core.jdbc.JdbcPooledConnectionImpl
-
- com.adaptris.core.jdbc.PluggableJdbcPooledConnection
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisConnection
,ComponentLifecycle
,ComponentLifecycleExtension
,StateManagedComponent
@ComponentProfile(summary="Connect to a database using a JDBC driver; connection pooling is pluggable", tag="connections,jdbc", since="3.9.2") public class PluggableJdbcPooledConnection extends JdbcPooledConnectionImpl
ConcreteJdbcPooledConnectionImpl
that allows you to plug in connection pool implementations.Generally, we find that c3p0 is good enough; however, in some use-cases you might want to switch to a different connection pool implementation. This variant allows you to plug in different builder implementations for the underlying connection pool.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.jdbc.JdbcPooledConnectionImpl
connectionPool
-
Fields inherited from class com.adaptris.core.AdaptrisConnectionImp
log
-
-
Constructor Summary
Constructors Constructor Description PluggableJdbcPooledConnection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PooledDataSource
createPool()
boolean
equals(java.lang.Object other)
Force implementations to over-ride equals with a semantic implementation.ConnectionPoolBuilder
getBuilder()
KeyValuePairSet
getPoolProperties()
int
hashCode()
Force implementations to over-ride hashcode.KeyValuePairSet
poolProperties()
void
setBuilder(ConnectionPoolBuilder builder)
Set the builder to use when creating the connection pool.void
setPoolProperties(KeyValuePairSet kvps)
Set any additional connection pool properties over and above the defaults.PluggableJdbcPooledConnection
withBuilder(ConnectionPoolBuilder builder)
PluggableJdbcPooledConnection
withPoolProperties(KeyValuePairSet values)
-
Methods inherited from class com.adaptris.core.jdbc.JdbcPooledConnectionImpl
asDataSource, closeDatabaseConnection, getConnectionName, getConnectUrl, initialiseDatabaseConnection, makeConnection, setConnectUrl, startDatabaseConnection, stopDatabaseConnection
-
Methods inherited from class com.adaptris.core.jdbc.DatabaseConnection
alwaysValidateConnection, autoCommit, checkInternalState, closeConnection, connect, connectionProperties, debugMode, getAlwaysValidateConnection, getAutoCommit, getConnectionProperties, getDebugMode, getDriverImp, getPassword, getUsername, initConnection, loadDriverClass, prepareConnection, setAlwaysValidateConnection, setAutoCommit, setConnectionProperties, setDebugMode, setDriverImp, setPassword, setUsername, startConnection, stopConnection
-
Methods inherited from class com.adaptris.core.AllowsRetriesConnection
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryInterval
-
Methods inherited from class com.adaptris.core.AdaptrisConnectionImp
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, getConnectionErrorHandler, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
-
-
-
-
Method Detail
-
createPool
protected PooledDataSource createPool() throws java.lang.Exception
- Specified by:
createPool
in classJdbcPooledConnectionImpl
- Throws:
java.lang.Exception
-
equals
public boolean equals(java.lang.Object other)
Description copied from class:DatabaseConnection
Force implementations to over-ride equals with a semantic implementation.
- Specified by:
equals
in classDatabaseConnection
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Description copied from class:DatabaseConnection
Force implementations to over-ride hashcode.
- Specified by:
hashCode
in classDatabaseConnection
- See Also:
Object.hashCode()
-
getBuilder
public ConnectionPoolBuilder getBuilder()
-
setBuilder
public void setBuilder(ConnectionPoolBuilder builder)
Set the builder to use when creating the connection pool.- Parameters:
builder
- the builder, if not specified, then defaults toDefaultPoolFactory
.
-
withBuilder
public PluggableJdbcPooledConnection withBuilder(ConnectionPoolBuilder builder)
-
getPoolProperties
public KeyValuePairSet getPoolProperties()
-
setPoolProperties
public void setPoolProperties(KeyValuePairSet kvps)
Set any additional connection pool properties over and above the defaults.By its very nature, since we don't know what connection pool implementation is going to be used, the specific keys and values required here will be dependent on the pool implementation. Please consult their documentation to figure out the correct values.
- Parameters:
kvps
- the connection pool properties.
-
poolProperties
public KeyValuePairSet poolProperties()
-
withPoolProperties
public PluggableJdbcPooledConnection withPoolProperties(KeyValuePairSet values)
-
-