public class HostMonitoringConnectionPlugin extends AbstractConnectionPlugin implements CanReleaseResources
| Modifier and Type | Field and Description |
|---|---|
static AwsWrapperProperty |
FAILURE_DETECTION_COUNT |
static AwsWrapperProperty |
FAILURE_DETECTION_ENABLED |
static AwsWrapperProperty |
FAILURE_DETECTION_INTERVAL |
static AwsWrapperProperty |
FAILURE_DETECTION_TIME |
protected @NonNull java.util.Properties |
properties |
| Constructor and Description |
|---|
HostMonitoringConnectionPlugin(@NonNull PluginService pluginService,
@NonNull java.util.Properties properties)
Initialize the node monitoring plugin.
|
| Modifier and Type | Method and Description |
|---|---|
java.sql.Connection |
connect(@NonNull java.lang.String driverProtocol,
@NonNull HostSpec hostSpec,
@NonNull java.util.Properties props,
boolean isInitialConnection,
@NonNull JdbcCallable<java.sql.Connection,java.sql.SQLException> connectFunc)
Establishes a connection to the given host using the given driver protocol and properties.
|
<T,E extends java.lang.Exception> |
execute(java.lang.Class<T> resultClass,
java.lang.Class<E> exceptionClass,
java.lang.Object methodInvokeOn,
java.lang.String methodName,
JdbcCallable<T,E> jdbcMethodFunc,
java.lang.Object[] jdbcMethodArgs)
Executes the given SQL function with
MonitorImpl if connection monitoring is enabled. |
java.sql.Connection |
forceConnect(@NonNull java.lang.String driverProtocol,
@NonNull HostSpec hostSpec,
@NonNull java.util.Properties props,
boolean isInitialConnection,
@NonNull JdbcCallable<java.sql.Connection,java.sql.SQLException> forceConnectFunc)
Establishes a connection to the given host using the given driver protocol and properties.
|
HostSpec |
getMonitoringHostSpec() |
java.util.Set<java.lang.String> |
getSubscribedMethods() |
OldConnectionSuggestedAction |
notifyConnectionChanged(java.util.EnumSet<NodeChangeOptions> changes) |
void |
releaseResources()
Call this plugin's monitor service to release all resources associated with this plugin.
|
acceptsStrategy, getHostSpecByStrategy, initHostProvider, notifyNodeListChangedpublic static final AwsWrapperProperty FAILURE_DETECTION_ENABLED
public static final AwsWrapperProperty FAILURE_DETECTION_TIME
public static final AwsWrapperProperty FAILURE_DETECTION_INTERVAL
public static final AwsWrapperProperty FAILURE_DETECTION_COUNT
protected @NonNull java.util.Properties properties
public HostMonitoringConnectionPlugin(@NonNull PluginService pluginService, @NonNull java.util.Properties properties)
pluginService - A service allowing the plugin to retrieve the current active connection
and its connection settings.properties - The property set used to initialize the active connection.public java.util.Set<java.lang.String> getSubscribedMethods()
getSubscribedMethods in interface ConnectionPlugingetSubscribedMethods in class AbstractConnectionPluginpublic <T,E extends java.lang.Exception> T execute(java.lang.Class<T> resultClass,
java.lang.Class<E> exceptionClass,
java.lang.Object methodInvokeOn,
java.lang.String methodName,
JdbcCallable<T,E> jdbcMethodFunc,
java.lang.Object[] jdbcMethodArgs)
throws E extends java.lang.Exception
MonitorImpl if connection monitoring is enabled.
Otherwise, executes the SQL function directly.execute in interface ConnectionPluginexecute in class AbstractConnectionPluginE extends java.lang.Exceptionpublic void releaseResources()
releaseResources in interface CanReleaseResourcespublic OldConnectionSuggestedAction notifyConnectionChanged(java.util.EnumSet<NodeChangeOptions> changes)
notifyConnectionChanged in interface ConnectionPluginnotifyConnectionChanged in class AbstractConnectionPluginpublic java.sql.Connection connect(@NonNull java.lang.String driverProtocol,
@NonNull HostSpec hostSpec,
@NonNull java.util.Properties props,
boolean isInitialConnection,
@NonNull JdbcCallable<java.sql.Connection,java.sql.SQLException> connectFunc)
throws java.sql.SQLException
ConnectionPluginConnectionProvider has been set with
ConnectionProviderManager.setConnectionProvider(software.amazon.jdbc.ConnectionProvider) and
ConnectionProvider.acceptsUrl(String, HostSpec, Properties) returns true for the given
protocol, host, and properties, the connection will be created by the non-default
ConnectionProvider. Otherwise, the connection will be created by the default
ConnectionProvider. The default ConnectionProvider will be DriverConnectionProvider for
connections requested via the DriverManager and
DataSourceConnectionProvider for connections requested via an
AwsWrapperDataSource.connect in interface ConnectionPluginconnect in class AbstractConnectionPlugindriverProtocol - the driver protocol that should be used to establish the connectionhostSpec - the host details for the desired connectionprops - the connection propertiesisInitialConnection - a boolean indicating whether the current Connection is
establishing an initial physical connection to the database or has
already established a physical connection in the pastconnectFunc - the function to call to continue the connect request down the
connect pipelineConnection to the requested hostjava.sql.SQLException - if there was an error establishing a Connection to the requested
hostpublic java.sql.Connection forceConnect(@NonNull java.lang.String driverProtocol,
@NonNull HostSpec hostSpec,
@NonNull java.util.Properties props,
boolean isInitialConnection,
@NonNull JdbcCallable<java.sql.Connection,java.sql.SQLException> forceConnectFunc)
throws java.sql.SQLException
ConnectionPluginConnectionPlugin.connect(java.lang.String, software.amazon.jdbc.HostSpec, java.util.Properties, boolean, software.amazon.jdbc.JdbcCallable<java.sql.Connection, java.sql.SQLException>) in that the default
ConnectionProvider will be used to establish the connection even if a non-default
ConnectionProvider has been set via ConnectionProviderManager.setConnectionProvider(software.amazon.jdbc.ConnectionProvider).
The default ConnectionProvider will be DriverConnectionProvider for connections
requested via the DriverManager and DataSourceConnectionProvider for
connections requested via an AwsWrapperDataSource.forceConnect in interface ConnectionPluginforceConnect in class AbstractConnectionPlugindriverProtocol - the driver protocol that should be used to establish the connectionhostSpec - the host details for the desired connectionprops - the connection propertiesisInitialConnection - a boolean indicating whether the current Connection is
establishing an initial physical connection to the database or has
already established a physical connection in the pastforceConnectFunc - the function to call to continue the forceConnect request down the
forceConnect pipelineConnection to the requested hostjava.sql.SQLException - if there was an error establishing a Connection to the requested
hostpublic HostSpec getMonitoringHostSpec()