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 int |
failureDetectionCount |
protected int |
failureDetectionIntervalMillis |
protected int |
failureDetectionTimeMillis |
protected boolean |
isEnabled |
protected @NonNull java.util.Properties |
properties |
protected java.util.Set<java.lang.String> |
subscribedMethods |
| 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
HostMonitorImpl if connection monitoring is enabled. |
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, forceConnect, getHostSpecByStrategy, 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 final java.util.Set<java.lang.String> subscribedMethods
protected @NonNull java.util.Properties properties
protected final boolean isEnabled
protected final int failureDetectionTimeMillis
protected final int failureDetectionIntervalMillis
protected final int failureDetectionCount
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
HostMonitorImpl 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
Driver.setCustomConnectionProvider(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 HostSpec getMonitoringHostSpec()