public final class FailoverConnection
extends java.lang.Object
The configured FailoverConfig#getTestStatement will be used to test the current connection. If the statement fails, then a reconnection attempt is made (provided there are available connection urls to try).
FailoverConfig
Constructor and Description |
---|
FailoverConnection(FailoverConfig config) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection.
|
FailoverConfig |
getConfig()
Get the configuration.
|
java.sql.Connection |
getConnection()
Returns the userConnection.
|
boolean |
isDebugMode()
Is this connection in debug mode.
|
void |
setConfig(FailoverConfig config)
Set the configuration.
|
public FailoverConnection(FailoverConfig config) throws java.sql.SQLException
java.sql.SQLException
public FailoverConfig getConfig()
public void setConfig(FailoverConfig config)
config
- the configuration.public void close() throws java.sql.SQLException
If the connection is closed, then any attempt to get the underlying connection will throw a SQLException
java.sql.SQLException
- on errorpublic java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
- on error.public boolean isDebugMode()