public static class HealthCheck.Result
extends java.lang.Object
healthy()
).Modifier and Type | Method and Description |
---|---|
java.lang.Throwable |
getError()
The exception representing an unhealthy check, may be
null . |
java.lang.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(java.lang.String message)
Creates a healthy result, with the given message.
|
static HealthCheck.Result |
healthy(java.lang.String message,
java.lang.Object... args)
Creates a healthy result, with the given message.
|
boolean |
isHealthy()
Was the component being checked healthy?
|
static HealthCheck.Result |
unhealthy(java.lang.String message)
Creates an unhealthy result, with the given message.
|
static HealthCheck.Result |
unhealthy(java.lang.String message,
java.lang.Object... args)
Creates an unhealthy result, with the given message.
|
static HealthCheck.Result |
unhealthy(java.lang.String message,
java.lang.Throwable error)
Creates an unhealthy result, with the given exception and message.
|
static HealthCheck.Result |
unhealthy(java.lang.Throwable error)
Creates an unhealthy result, with the given exception.
|
public boolean isHealthy()
true
if application component is healthy@Nullable public java.lang.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 java.lang.Throwable getError()
null
.
Healthy results will never have an associated error.
null
public static HealthCheck.Result healthy()
public static HealthCheck.Result healthy(java.lang.String message)
message
- a message to accompany the resultpublic static HealthCheck.Result healthy(java.lang.String message, java.lang.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(java.lang.String message)
message
- a message to accompany the resultpublic static HealthCheck.Result unhealthy(java.lang.String message, java.lang.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(java.lang.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(java.lang.String message, java.lang.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