public static class HealthCheck.Result extends Object
healthy()).| Modifier and Type | Method and Description |
|---|---|
Throwable |
getError()
The exception representing an unhealthy check, may be
null. |
String |
getMessage()
Any message provided as part of the check, may be
null. |
static HealthCheck.Result |
healthy()
Creates a healthy result, with no message.
|
static HealthCheck.Result |
healthy(String message)
Creates a healthy result, with the given message.
|
static HealthCheck.Result |
healthy(String message,
Object... args)
Creates a healthy result, with the given message.
|
boolean |
isHealthy()
Was the component being checked healthy?
|
static HealthCheck.Result |
unhealthy(String message)
Creates an unhealthy result, with the given message.
|
static HealthCheck.Result |
unhealthy(String message,
Object... args)
Creates an unhealthy result, with the given message.
|
static HealthCheck.Result |
unhealthy(String message,
Throwable error)
Creates an unhealthy result, with the given exception and message.
|
static HealthCheck.Result |
unhealthy(Throwable error)
Creates an unhealthy result, with the given exception.
|
public boolean isHealthy()
true if application component is healthy@Nullable public String getMessage()
null.
A message may be provided with a healthy or unhealthy result.
If getError() is non null, this message will be the message provided by that exception.
null@Nullable public Throwable getError()
null.
Healthy results will never have an associated error.
nullpublic static HealthCheck.Result healthy()
public static HealthCheck.Result healthy(String message)
message - a message to accompany the resultpublic static HealthCheck.Result healthy(String message, Object... args)
The message is constructed by String.format(String, Object...) and the given arguments.
message - the message format stringsargs - values to be interpolated into the format stringpublic static HealthCheck.Result unhealthy(String message)
message - a message to accompany the resultpublic static HealthCheck.Result unhealthy(String message, Object... args)
The message is constructed by String.format(String, Object...) and the given arguments.
message - the message format stringsargs - values to be interpolated into the format stringpublic static HealthCheck.Result unhealthy(Throwable error)
The message of the given exception will also be used as the message of the result.
error - an exception thrown during health checkpublic static HealthCheck.Result unhealthy(String message, Throwable error)
The supplied message will be used as the message of the result.
message - a message to accompany the resulterror - an exception thrown during health check