public abstract class HealthCheck
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HealthCheck.Result
The result of a
HealthCheck being run. |
Modifier | Constructor and Description |
---|---|
protected |
HealthCheck(java.lang.String name)
Create a new
HealthCheck instance with the given name. |
Modifier and Type | Method and Description |
---|---|
protected abstract HealthCheck.Result |
check()
Perform a check of the application component.
|
HealthCheck.Result |
execute()
Executes the health check, catching and handling any exceptions raised by
check() . |
java.lang.String |
getName()
Returns the health check's name.
|
protected HealthCheck(java.lang.String name)
HealthCheck
instance with the given name.name
- the name of the health check (and, ideally, the name of the underlying
component the health check tests)public java.lang.String getName()
protected abstract HealthCheck.Result check() throws java.lang.Exception
HealthCheck.Result
; otherwise, an unhealthy
HealthCheck.Result
with a descriptive error message or exceptionjava.lang.Exception
- if there is an unhandled error during the health check; this will result in
a failed health checkpublic HealthCheck.Result execute()
check()
.HealthCheck.Result
; otherwise, an unhealthy
HealthCheck.Result
with a descriptive error message or exception