Interface HealthService<T>
- All Known Implementing Classes:
ServiceHealthAggregator
public interface HealthService<T>
An interface which can be used to track the health of any service
You can add a set of monitors, and a general health will be tracked by
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddInlineMonitor(Monitor<T> monitor) Add a monitor which will be run in the same thread.voidaddIsolatedMonitor(IsolatedHealthMonitor<T> monitor) Register a monitor to the service, to setup a continuous monitoring on the monitor this method can be used to add aIsolatedHealthMonitorwhich will later be scheduled at regular intervals and monitored to generate and maintain an aggregated health of the service the scheduling will happen in an isolated threadaggregate all registered (enabled) monitors, collect individual monitor healths, and aggregate them accordinglyvoidstart()Start monitoring all registered monitors.voidstop()Stop the health service, and stop tracking all monitors
-
Method Details
-
addIsolatedMonitor
Register a monitor to the service, to setup a continuous monitoring on the monitor this method can be used to add aIsolatedHealthMonitorwhich will later be scheduled at regular intervals and monitored to generate and maintain an aggregated health of the service the scheduling will happen in an isolated thread- Parameters:
monitor- an implementation of theIsolatedHealthMonitor
-
addInlineMonitor
Add a monitor which will be run in the same thread. this method can be used to add aMonitorthis monitor will not be scheduled in a separate isolated thread, but instead its execution will happen inline, in a single thread, along with other inline monitors- Parameters:
monitor- an implementation of lineMonitor
-
start
void start()Start monitoring all registered monitors. Start individual monitors -
stop
void stop()Stop the health service, and stop tracking all monitors -
getServiceHealth
T getServiceHealth()aggregate all registered (enabled) monitors, collect individual monitor healths, and aggregate them accordingly- Returns:
- the aggregated health of the service
-