Package com.codahale.metrics.health
Class HealthCheck
- java.lang.Object
-
- com.codahale.metrics.health.HealthCheck
-
- Direct Known Subclasses:
AsyncHealthCheckDecorator,ThreadDeadlockHealthCheck
public abstract class HealthCheck extends Object
A health check for a component of your application.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHealthCheck.ResultThe result of aHealthCheckbeing run.static classHealthCheck.ResultBuilderThis a convenient builder for anHealthCheck.Result.
-
Constructor Summary
Constructors Constructor Description HealthCheck()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract HealthCheck.Resultcheck()Perform a check of the application component.protected com.codahale.metrics.Clockclock()HealthCheck.Resultexecute()Executes the health check, catching and handling any exceptions raised bycheck().
-
-
-
Method Detail
-
check
protected abstract HealthCheck.Result check() throws Exception
Perform a check of the application component.- Returns:
- if the component is healthy, a healthy
HealthCheck.Result; otherwise, an unhealthyHealthCheck.Resultwith 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
public HealthCheck.Result 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.Resultwith a descriptive error message or exception
-
clock
protected com.codahale.metrics.Clock clock()
-
-