Class HealthCheckRegistry
java.lang.Object
com.codahale.metrics.health.HealthCheckRegistry
A registry for health checks.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentMap<String, HealthCheck> private static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetNames()Returns a set of the names of all registered health checks.voidregister(String name, HealthCheck healthCheck) Registers an applicationHealthCheck.runHealthCheck(String name) Runs the health check with the given name.Runs the registered health checks and returns a map of the results.runHealthChecks(ExecutorService executor) Runs the registered health checks in parallel and returns a map of the results.voidunregister(String name) Unregisters the applicationHealthCheckwith the given name.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
healthChecks
-
-
Constructor Details
-
HealthCheckRegistry
public HealthCheckRegistry()Creates a newHealthCheckRegistry.
-
-
Method Details
-
register
Registers an applicationHealthCheck.- Parameters:
name- the name of the health checkhealthCheck- theHealthCheckinstance
-
unregister
Unregisters the applicationHealthCheckwith the given name.- Parameters:
name- the name of theHealthCheckinstance
-
getNames
-
runHealthCheck
Runs the health check with the given name.- Parameters:
name- the health check's name- Returns:
- the result of the health check
- Throws:
NoSuchElementException- if there is no health check with the given name
-
runHealthChecks
Runs the registered health checks and returns a map of the results.- Returns:
- a map of the health check results
-
runHealthChecks
Runs the registered health checks in parallel and returns a map of the results.- Returns:
- a map of the health check results
-