Class ServiceHealthAggregator
java.lang.Object
io.appform.ranger.core.healthservice.ServiceHealthAggregator
- All Implemented Interfaces:
Healthcheck,HealthService<HealthcheckStatus>
public class ServiceHealthAggregator
extends Object
implements HealthService<HealthcheckStatus>, Healthcheck
This is a simple
HealthService implementation,
which can be used to register a set of IsolatedHealthMonitors and get an aggregated health of the service.
The aggregated health is maintained by scheduling and running the set of registered (enabled) monitors at regular intervals.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInlineMonitor(Monitor<HealthcheckStatus> monitor) 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 monitorsvoidthis 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 threadcheck()return healthy/unhealthy status of the serviceaggregate all registered (enabled) monitors, collect individual monitor healths, and aggregate them accordinglyvoidstart()start monitoring all registered monitors (triggers a scheduled execution of all registered monitors) and saves their futures for later reference)voidstop()stop all running monitors
-
Constructor Details
-
ServiceHealthAggregator
public ServiceHealthAggregator()
-
-
Method Details
-
addIsolatedMonitor
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- Specified by:
addIsolatedMonitorin interfaceHealthService<HealthcheckStatus>- Parameters:
monitor- any extension of theIsolatedHealthMonitor
-
addInlineMonitor
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- Specified by:
addInlineMonitorin interfaceHealthService<HealthcheckStatus>- Parameters:
monitor- an implementation of lineMonitor
-
start
public void start()start monitoring all registered monitors (triggers a scheduled execution of all registered monitors) and saves their futures for later reference)- Specified by:
startin interfaceHealthService<HealthcheckStatus>
-
stop
public void stop()stop all running monitors- Specified by:
stopin interfaceHealthService<HealthcheckStatus>
-
getServiceHealth
aggregate all registered (enabled) monitors, collect individual monitor healths, and aggregate them accordingly- Specified by:
getServiceHealthin interfaceHealthService<HealthcheckStatus>- Returns:
- the aggregated health of the service
-
check
Description copied from interface:Healthcheckreturn healthy/unhealthy status of the service- Specified by:
checkin interfaceHealthcheck- Returns:
- health status
-