Package com.codahale.metrics.health
Class HealthCheck
java.lang.Object
com.codahale.metrics.health.HealthCheck
- Direct Known Subclasses:
AsyncHealthCheckDecorator
,ThreadDeadlockHealthCheck
A health check for a component of your application.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The result of aHealthCheck
being run.static class
This a convenient builder for anHealthCheck.Result
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract HealthCheck.Result
check()
Perform a check of the application component.protected com.codahale.metrics.Clock
clock()
execute()
Executes the health check, catching and handling any exceptions raised bycheck()
.
-
Constructor Details
-
HealthCheck
public HealthCheck()
-
-
Method Details
-
check
Perform a check of the application component.- Returns:
- if the component is healthy, a healthy
HealthCheck.Result
; otherwise, an unhealthyHealthCheck.Result
with a descriptive error message or exception - Throws:
Exception
- if there is an unhandled error during the health check; this will result in a failed health check
-
execute
Executes the health check, catching and handling any exceptions raised bycheck()
.- Returns:
- if the component is healthy, a healthy
HealthCheck.Result
; otherwise, an unhealthyHealthCheck.Result
with a descriptive error message or exception
-
clock
protected com.codahale.metrics.Clock clock()
-