public static class HealthCheck.Result extends Object
HealthCheck
being run. It can be healthy (with an optional message and optional details)
or unhealthy (with either an error message or a thrown exception and optional details).Modifier and Type | Method and Description |
---|---|
static HealthCheck.ResultBuilder |
builder()
Returns a new
HealthCheck.ResultBuilder |
boolean |
equals(Object o) |
Map<String,Object> |
getDetails() |
Throwable |
getError()
Returns any exception for the result, or
null if the result has no exception. |
String |
getMessage()
Returns any additional message for the result, or
null if the result has no
message. |
String |
getTimestamp()
Returns the timestamp when the result was created.
|
int |
hashCode() |
static HealthCheck.Result |
healthy()
Returns a healthy
HealthCheck.Result with no additional message. |
static HealthCheck.Result |
healthy(String message)
Returns a healthy
HealthCheck.Result with an additional message. |
static HealthCheck.Result |
healthy(String message,
Object... args)
Returns a healthy
HealthCheck.Result with a formatted message. |
boolean |
isHealthy()
Returns
true if the result indicates the component is healthy; false
otherwise. |
String |
toString() |
static HealthCheck.Result |
unhealthy(String message)
Returns an unhealthy
HealthCheck.Result with the given message. |
static HealthCheck.Result |
unhealthy(String message,
Object... args)
Returns an unhealthy
HealthCheck.Result with a formatted message. |
static HealthCheck.Result |
unhealthy(Throwable error)
Returns an unhealthy
HealthCheck.Result with the given error. |
public static HealthCheck.Result healthy()
HealthCheck.Result
with no additional message.HealthCheck.Result
with no additional messagepublic static HealthCheck.Result healthy(String message)
HealthCheck.Result
with an additional message.message
- an informative messageHealthCheck.Result
with an additional messagepublic static HealthCheck.Result healthy(String message, Object... args)
HealthCheck.Result
with a formatted message.
Message formatting follows the same rules as String.format(String, Object...)
.message
- a message formatargs
- the arguments apply to the message formatHealthCheck.Result
with an additional messageString.format(String, Object...)
public static HealthCheck.Result unhealthy(String message)
HealthCheck.Result
with the given message.message
- an informative message describing how the health check failedHealthCheck.Result
with the given messagepublic static HealthCheck.Result unhealthy(String message, Object... args)
HealthCheck.Result
with a formatted message.
Message formatting follows the same rules as String.format(String, Object...)
.message
- a message formatargs
- the arguments apply to the message formatHealthCheck.Result
with an additional messageString.format(String, Object...)
public static HealthCheck.Result unhealthy(Throwable error)
HealthCheck.Result
with the given error.error
- an exception thrown during the health checkHealthCheck.Result
with the given error
public static HealthCheck.ResultBuilder builder()
HealthCheck.ResultBuilder
HealthCheck.ResultBuilder
public boolean isHealthy()
true
if the result indicates the component is healthy; false
otherwise.true
if the result indicates the component is healthypublic String getMessage()
null
if the result has no
message.null
public Throwable getError()
null
if the result has no exception.null
public String getTimestamp()
Copyright © 2020. All Rights Reserved.