public final class ReportingLoop extends Object implements Runnable, ProbeReportHandler, MonitorKeys, Closeable
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
BOOTSTRAP_TIMEOUT_DEFAULT, DEFAULT_PROBE_HOST, DEFAULT_PROBE_PORT, JT_PROBE_BOOTSTRAP_TIMEOUT, JT_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT, JT_PROBE_ENABLED, LS_PROBE_BOOTSTRAP_TIMEOUT, LS_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT, LS_PROBE_DEFAULT, LS_PROBE_ENABLED, LS_PROBE_PATH, MONITOR_BOOTSTRAP_TIMEOUT, MONITOR_DEPENDENCY_DFSLIVE, MONITOR_KEY_PREFIX, MONITOR_PROBE_INTERVAL, MONITOR_PROBE_TIMEOUT, MONITOR_REPORT_INTERVAL, MONITOR_REPORTER, PID_PROBE_ENABLED, PID_PROBE_PIDFILE, PORT_PROBE_BOOTSTRAP_TIMEOUT, PORT_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT, PORT_PROBE_CONNECT_TIMEOUT, PORT_PROBE_CONNECT_TIMEOUT_DEFAULT, PORT_PROBE_ENABLED, PORT_PROBE_HOST, PORT_PROBE_PORT, PROBE_INTERVAL_DEFAULT, PROBE_TIMEOUT_DEFAULT, REPORT_INTERVAL_DEFAULT, WEB_PROBE_BOOTSTRAP_TIMEOUT, WEB_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT, WEB_PROBE_CONNECT_TIMEOUT, WEB_PROBE_DEFAULT_CODE, WEB_PROBE_DEFAULT_URL, WEB_PROBE_ENABLED, WEB_PROBE_MAX, WEB_PROBE_MIN, WEB_PROBE_URL| Constructor and Description |
|---|
ReportingLoop(String name,
ProbeReportHandler reporter,
List<Probe> probes,
List<Probe> dependencyProbes,
int probeInterval,
int reportInterval,
int probeTimeout,
int bootstrapTimeout) |
ReportingLoop(String name,
ProbeReportHandler reporter,
ProbeWorker worker,
int reportInterval,
int probeTimeout)
Create a new reporting loop -and bond the worker's ProbeReportHandler
to us
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This exits the process cleanly
|
boolean |
commence(String n,
String description) |
int |
getBootstrapTimeout() |
void |
heartbeat(ProbeStatus status)
A heartbeat event should be raised
|
void |
liveProbeCycleCompleted()
Event to say that the live probe cycle completed so the entire
system can be considered functional.
|
void |
probeBooted(ProbeStatus status)
A probe has just booted
|
void |
probeFailure(ProbeFailedException exception)
A probe has failed
|
void |
probeProcessStateChange(ProbePhase probePhase)
The probe process has changed state.
|
void |
probeResult(ProbePhase phase,
ProbeStatus status)
Report a probe outcome
|
void |
probeTimedOut(ProbePhase currentPhase,
Probe probe,
ProbeStatus lastStatus,
long currentTime)
A probe has timed out
|
void |
run()
This can be run in a separate thread, or it can be run directly from the caller.
|
boolean |
startReporting()
Start the monitoring.
|
void |
unregister() |
ReportingLoop |
withReporter(ProbeReportHandler reporter) |
public ReportingLoop(String name, ProbeReportHandler reporter, List<Probe> probes, List<Probe> dependencyProbes, int probeInterval, int reportInterval, int probeTimeout, int bootstrapTimeout) throws IOException
IOExceptionpublic ReportingLoop(String name, ProbeReportHandler reporter, ProbeWorker worker, int reportInterval, int probeTimeout) throws IOException
name - reporter - worker - reportInterval - probeTimeout - IOExceptionpublic int getBootstrapTimeout()
public ReportingLoop withReporter(ProbeReportHandler reporter)
public boolean startReporting()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic void probeFailure(ProbeFailedException exception)
ProbeReportHandlerprobeFailure in interface ProbeReportHandlerpublic void probeProcessStateChange(ProbePhase probePhase)
ProbeReportHandlerprobeProcessStateChange in interface ProbeReportHandlerprobePhase - the new process phrasepublic void probeBooted(ProbeStatus status)
ProbeReportHandlerprobeBooted in interface ProbeReportHandlerstatus - probe statuspublic void probeResult(ProbePhase phase, ProbeStatus status)
ProbeReportHandlerprobeResult in interface ProbeReportHandlerphase - the current phase of probingstatus - the probe statuspublic boolean commence(String n, String description)
commence in interface ProbeReportHandlerpublic void unregister()
unregister in interface ProbeReportHandlerpublic void heartbeat(ProbeStatus status)
ProbeReportHandlerheartbeat in interface ProbeReportHandlerstatus - the probe statuspublic void probeTimedOut(ProbePhase currentPhase, Probe probe, ProbeStatus lastStatus, long currentTime)
ProbeReportHandlerprobeTimedOut in interface ProbeReportHandlercurrentPhase - the current execution phaseprobe - the probe that timed outlastStatus - the last status that was successfully received -which is implicitly
not the status of the timed out probecurrentTime - the current timepublic void liveProbeCycleCompleted()
ProbeReportHandlerliveProbeCycleCompleted in interface ProbeReportHandlerCopyright © 2014–2015 The Apache Software Foundation. All rights reserved.