public class HostMonitorV2Impl extends AbstractMonitor implements HostMonitor, StateSnapshotProvider
Connection.| Modifier and Type | Field and Description |
|---|---|
protected @Nullable TelemetryCounter |
abortedConnectionsCounter |
protected java.util.concurrent.Executor |
abortExecutor |
protected HostSpec |
hostSpec |
protected AtomicConnection |
monitoringConn |
protected java.util.Properties |
monitoringProperties |
protected java.util.Properties |
properties |
protected FullServicesContainer |
servicesContainer |
protected TelemetryFactory |
telemetryFactory |
lastActivityTimestampNanos, monitorExecutor, state, stop, terminationTimeoutSec| Constructor and Description |
|---|
HostMonitorV2Impl(@NonNull FullServicesContainer servicesContainer,
@NonNull HostSpec hostSpec,
@NonNull java.util.Properties properties,
int failureDetectionTimeMillis,
int failureDetectionIntervalMillis,
int failureDetectionCount,
@Nullable TelemetryCounter abortedConnectionsCounter) |
HostMonitorV2Impl(@NonNull FullServicesContainer servicesContainer,
@NonNull HostSpec hostSpec,
@NonNull java.util.Properties properties,
int failureDetectionTimeMillis,
int failureDetectionIntervalMillis,
int failureDetectionCount,
@Nullable TelemetryCounter abortedConnectionsCounter,
long terminationTimeoutSec,
java.lang.String threadName)
Store the monitoring configuration for a connection.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
abortConnection(@NonNull java.sql.Connection connectionToAbort) |
boolean |
canDispose()
Defines whether this monitor can be disposed.
|
void |
close()
Closes all resources used by this monitor.
|
protected long |
getCurrentTimeNano() |
java.util.List<Pair<java.lang.String,java.lang.Object>> |
getSnapshotState() |
void |
monitor()
Executes the monitoring loop for this monitor.
|
void |
newContextRun() |
void |
processEvent(Event event)
Processes an event.
|
protected void |
reset() |
void |
start()
Submits this monitor in a separate thread to begin its monitoring tasks.
|
void |
startMonitoring(ConnectionContext context) |
protected long |
truncateNanoToSeconds(long timeNano) |
protected void |
updateNodeHealthStatus(boolean connectionValid,
long statusCheckStartNano,
long statusCheckEndNano) |
getLastActivityTimestampNanos, getState, run, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLastActivityTimestampNanos, getState, stopprotected final java.util.concurrent.Executor abortExecutor
protected final FullServicesContainer servicesContainer
protected final TelemetryFactory telemetryFactory
protected final java.util.Properties properties
protected final java.util.Properties monitoringProperties
protected final HostSpec hostSpec
protected AtomicConnection monitoringConn
protected final @Nullable TelemetryCounter abortedConnectionsCounter
public HostMonitorV2Impl(@NonNull FullServicesContainer servicesContainer, @NonNull HostSpec hostSpec, @NonNull java.util.Properties properties, int failureDetectionTimeMillis, int failureDetectionIntervalMillis, int failureDetectionCount, @Nullable TelemetryCounter abortedConnectionsCounter)
public HostMonitorV2Impl(@NonNull FullServicesContainer servicesContainer, @NonNull HostSpec hostSpec, @NonNull java.util.Properties properties, int failureDetectionTimeMillis, int failureDetectionIntervalMillis, int failureDetectionCount, @Nullable TelemetryCounter abortedConnectionsCounter, long terminationTimeoutSec, java.lang.String threadName)
servicesContainer - The telemetry factory to use to create telemetry data.hostSpec - The HostSpec of the server this HostMonitorV2Impl
instance is monitoring.properties - The Properties containing additional monitoring
configuration.failureDetectionTimeMillis - A failure detection time in millis.failureDetectionIntervalMillis - A failure detection interval in millis.failureDetectionCount - A failure detection count.abortedConnectionsCounter - Aborted connection telemetry counter.terminationTimeoutSec - The monitor termination timeout in seconds.threadName - The monitoring thread namepublic boolean canDispose()
MonitorcanDispose in interface MonitorcanDispose in class AbstractMonitorpublic void start()
Monitorstart in interface Monitorstart in class AbstractMonitorpublic void startMonitoring(ConnectionContext context)
startMonitoring in interface HostMonitorprotected long truncateNanoToSeconds(long timeNano)
protected long getCurrentTimeNano()
public void newContextRun()
public void monitor()
MonitorMonitor.start(). Additionally, the monitoring loop should regularly update the last
activity timestamp so that the MonitorService can detect whether the monitor is stuck or not.protected void updateNodeHealthStatus(boolean connectionValid,
long statusCheckStartNano,
long statusCheckEndNano)
protected void abortConnection(@NonNull java.sql.Connection connectionToAbort)
public void close()
MonitorMonitor.stop().close in interface java.lang.AutoCloseableclose in interface Monitorclose in class AbstractMonitorprotected void reset()
public void processEvent(Event event)
EventSubscriberEventPublisher.subscribe(software.amazon.jdbc.util.events.EventSubscriber, java.util.Set<java.lang.Class<? extends software.amazon.jdbc.util.events.Event>>).processEvent in interface EventSubscriberevent - the event to process.public java.util.List<Pair<java.lang.String,java.lang.Object>> getSnapshotState()
getSnapshotState in interface StateSnapshotProvider