public class HostMonitorImpl extends AbstractMonitor implements HostMonitor
Connection.| Modifier and Type | Field and Description |
|---|---|
protected static java.util.concurrent.Executor |
ABORT_EXECUTOR |
lastActivityTimestampNanos, monitorExecutor, state, stop, terminationTimeoutSec| Constructor and Description |
|---|
HostMonitorImpl(@NonNull ConnectionService connectionService,
@NonNull TelemetryFactory telemetryFactory,
@NonNull HostSpec hostSpec,
@NonNull java.util.Properties properties,
int failureDetectionTimeMillis,
int failureDetectionIntervalMillis,
int failureDetectionCount,
TelemetryCounter abortedConnectionsCounter)
Store the monitoring configuration for a connection.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDispose()
Defines whether this monitor can be disposed.
|
void |
close()
Closes all resources used by this monitor.
|
void |
monitor()
Executes the monitoring loop for this monitor.
|
void |
newContextRun() |
void |
start()
Submits this monitor in a separate thread to begin its monitoring tasks.
|
void |
startMonitoring(HostMonitorConnectionContext context) |
getLastActivityTimestampNanos, getState, run, stoppublic HostMonitorImpl(@NonNull ConnectionService connectionService, @NonNull TelemetryFactory telemetryFactory, @NonNull HostSpec hostSpec, @NonNull java.util.Properties properties, int failureDetectionTimeMillis, int failureDetectionIntervalMillis, int failureDetectionCount, TelemetryCounter abortedConnectionsCounter)
connectionService - The service to use to create the monitoring connection.telemetryFactory - The telemetry factory to use to create telemetry data.hostSpec - The HostSpec of the server this HostMonitorImpl
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.public boolean canDispose()
MonitorcanDispose in interface HostMonitorcanDispose in interface MonitorcanDispose in class AbstractMonitorpublic void start()
Monitorstart in interface Monitorstart in class AbstractMonitorpublic void startMonitoring(HostMonitorConnectionContext context)
startMonitoring in interface HostMonitorpublic 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.public void close()
MonitorMonitor.stop().close in interface java.lang.AutoCloseableclose in interface Monitorclose in class AbstractMonitor