public abstract class HostMonitoringConnectionBasePlugin extends AbstractConnectionPlugin implements CanReleaseResources, StateSnapshotProvider
| 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 boolean |
isEnabled |
protected @Nullable HostSpec |
monitoringHostSpec |
protected @Nullable HostMonitorService |
monitorService |
protected @NonNull java.util.function.Supplier<HostMonitorService> |
monitorServiceSupplier |
protected @NonNull PluginService |
pluginService |
protected @NonNull java.util.Properties |
properties |
protected RdsUtils |
rdsHelper |
protected java.util.Set<java.lang.String> |
subscribedMethods |
| Modifier | Constructor and Description |
|---|---|
protected |
HostMonitoringConnectionBasePlugin(@NonNull FullServicesContainer servicesContainer,
@NonNull java.util.Properties properties,
@NonNull java.util.function.Supplier<HostMonitorService> monitorServiceSupplier,
RdsUtils rdsHelper)
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,
@Nullable java.lang.Object[] jdbcMethodArgs)
Executes the given SQL function with
HostMonitorV2Impl
if connection monitoring is enabled. |
HostSpec |
getMonitoringHostSpec() |
java.util.List<Pair<java.lang.String,java.lang.Object>> |
getSnapshotState() |
java.util.Set<java.lang.String> |
getSubscribedMethods() |
protected HostMonitorService |
initMonitorService() |
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 @NonNull java.util.function.Supplier<HostMonitorService> monitorServiceSupplier
protected final @NonNull PluginService pluginService
protected @Nullable HostMonitorService monitorService
protected final RdsUtils rdsHelper
protected @Nullable HostSpec monitoringHostSpec
protected final boolean isEnabled
protected HostMonitoringConnectionBasePlugin(@NonNull FullServicesContainer servicesContainer, @NonNull java.util.Properties properties, @NonNull java.util.function.Supplier<HostMonitorService> monitorServiceSupplier, RdsUtils rdsHelper)
servicesContainer - The service container for the services required by this class.properties - The property set used to initialize the active connection.monitorServiceSupplier - A supplier for creating a HostMonitorService instance.rdsHelper - The RDS helper class to identify RDS instances.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,
@Nullable java.lang.Object[] jdbcMethodArgs)
throws E extends java.lang.Exception
HostMonitorV2Impl
if connection monitoring is enabled.
Otherwise, executes the SQL function directly.execute in interface ConnectionPluginexecute in class AbstractConnectionPluginE extends java.lang.Exceptionprotected HostMonitorService initMonitorService()
public 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()
public java.util.List<Pair<java.lang.String,java.lang.Object>> getSnapshotState()
getSnapshotState in interface StateSnapshotProvidergetSnapshotState in class AbstractConnectionPlugin