Class FailoverJdbcConnection
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisConnection,ComponentLifecycle,ComponentLifecycleExtension,StateManagedComponent
An AdaptrisConnection implementation for a failover database connection.
This class simply proxies com.adaptris.jdbc.connection.FailoverConnection with the required AdaptrisConnection
methods.
- See Also:
In the adapter configuration file this class is aliased as failover-jdbc-connection which is the preferred alternative to the fully qualified classname when building your configuration.
-
Field Summary
Fields inherited from class com.adaptris.core.AdaptrisConnectionImp
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a Connection URL to the configured list.protected voidInitialise the underlying database connection.booleanForce implementations to over-ride equals with a semantic implementation.protected StringReturns a name for this connection for logging purposes.Get the configured list of URLs.inthashCode()Force implementations to over-ride hashcode.protected voidInitialise the underlying database connection.protected ConnectionMake the connection.voidsetConnectUrls(List<String> l) Set the configured list of URLs.protected voidInitialise the underlying database connection.protected voidInitialise the underlying database connection.Methods inherited from class com.adaptris.core.jdbc.DatabaseConnection
alwaysValidateConnection, asDataSource, autoCommit, checkInternalState, closeConnection, connect, connectionProperties, debugMode, getAlwaysValidateConnection, getAutoCommit, getConnectionProperties, getDebugMode, getPassword, getUsername, initConnection, loadDriverClass, prepareConnection, setAlwaysValidateConnection, setAutoCommit, setConnectionProperties, setDebugMode, setPassword, setUsername, startConnection, stopConnectionMethods inherited from class com.adaptris.core.AllowsRetriesConnection
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryIntervalMethods inherited from class com.adaptris.core.AdaptrisConnectionImp
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, connectionStateHandler, getConnectionErrorHandler, getConnectionStateHandler, getRuntimeComponent, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setConnectionStateHandler, setRuntimeComponent, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
-
Constructor Details
-
FailoverJdbcConnection
public FailoverJdbcConnection()Creates a new instance.
-
alwaysValidateConnection is true, changing that to false has no
meaning as it would be impossible to failover to another connection
-
-
Method Details
-
makeConnection
Description copied from class:DatabaseConnectionMake the connection.
This abstract method should be implemented by concrete sub-classes to make or check the current connection to the Jdbc source.
- Specified by:
makeConnectionin classDatabaseConnection- Returns:
- a java.sql.Connection
- Throws:
SQLException- if the connection could not be made.- See Also:
-
stopDatabaseConnection
protected void stopDatabaseConnection()Description copied from class:DatabaseConnectionInitialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to stop any components other than the DriverManager.
- Specified by:
stopDatabaseConnectionin classDatabaseConnection
-
closeDatabaseConnection
protected void closeDatabaseConnection()Description copied from class:DatabaseConnectionInitialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to close any components.
- Specified by:
closeDatabaseConnectionin classDatabaseConnection- See Also:
-
startDatabaseConnection
Description copied from class:DatabaseConnectionInitialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to initialise any components other than the DriverManager.
- Specified by:
startDatabaseConnectionin classDatabaseConnection- Throws:
CoreException- wrapping any underlying exception.- See Also:
-
initialiseDatabaseConnection
Description copied from class:DatabaseConnectionInitialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to initialise any components other than the DriverManager.
- Specified by:
initialiseDatabaseConnectionin classDatabaseConnection- Throws:
CoreException- wrapping any underlying exception.- See Also:
-
addConnectUrl
Add a Connection URL to the configured list.- Parameters:
s- a connection url
-
getConnectUrls
Get the configured list of URLs.- Returns:
- the list of urls
-
setConnectUrls
Set the configured list of URLs.- Parameters:
l- the list of urls
-
equals
Description copied from class:DatabaseConnectionForce implementations to over-ride equals with a semantic implementation.
- Specified by:
equalsin classDatabaseConnection- See Also:
-
hashCode
public int hashCode()Description copied from class:DatabaseConnectionForce implementations to over-ride hashcode.
- Specified by:
hashCodein classDatabaseConnection- See Also:
-
getConnectionName
Description copied from class:DatabaseConnectionReturns a name for this connection for logging purposes.
- Specified by:
getConnectionNamein classDatabaseConnection- Returns:
- a name for this connection for logging purposes
- See Also:
-