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
Concrete
JdbcPooledConnectionImpl
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected PooledDataSource
boolean
Force implementations to over-ride equals with a semantic implementation.int
hashCode()
Force implementations to over-ride hashcode.void
setBuilder
(ConnectionPoolBuilder builder) Set the builder to use when creating the connection pool.void
Set any additional connection pool properties over and above the defaults.withBuilder
(ConnectionPoolBuilder builder) 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
-
Constructor Details
-
PluggableJdbcPooledConnection
public PluggableJdbcPooledConnection()
-
-
Method Details
-
createPool
- Specified by:
createPool
in classJdbcPooledConnectionImpl
- Throws:
Exception
-
equals
Description copied from class:DatabaseConnection
Force implementations to over-ride equals with a semantic implementation.
- Specified by:
equals
in classDatabaseConnection
- See Also:
-
hashCode
public int hashCode()Description copied from class:DatabaseConnection
Force implementations to over-ride hashcode.
- Specified by:
hashCode
in classDatabaseConnection
- See Also:
-
getBuilder
-
setBuilder
Set the builder to use when creating the connection pool.- Parameters:
builder
- the builder, if not specified, then defaults toDefaultPoolFactory
.
-
withBuilder
-
getPoolProperties
-
setPoolProperties
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
-
withPoolProperties
-