Package com.codahale.metrics.health
Class HealthCheck.Result
java.lang.Object
com.codahale.metrics.health.HealthCheck.Result
- Enclosing class:
HealthCheck
The result of a
HealthCheck
being run. It can be healthy (with an optional message)
or unhealthy (with either an error message or a thrown exception).-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getError()
Returns any exception for the result, ornull
if the result has no exception.Returns any additional message for the result, ornull
if the result has no message.int
hashCode()
static HealthCheck.Result
healthy()
Returns a healthyHealthCheck.Result
with no additional message.static HealthCheck.Result
Returns a healthyHealthCheck.Result
with an additional message.static HealthCheck.Result
Returns a healthyHealthCheck.Result
with a formatted message.boolean
Returnstrue
if the result indicates the component is healthy;false
otherwise.toString()
static HealthCheck.Result
Returns an unhealthyHealthCheck.Result
with the given message.static HealthCheck.Result
Returns an unhealthyHealthCheck.Result
with a formatted message.static HealthCheck.Result
Returns an unhealthyHealthCheck.Result
with the given error.
-
Field Details
-
HEALTHY
-
PRIME
private static final int PRIME- See Also:
-
healthy
private final boolean healthy -
message
-
error
-
-
Constructor Details
-
Result
-
-
Method Details
-
healthy
Returns a healthyHealthCheck.Result
with no additional message.- Returns:
- a healthy
HealthCheck.Result
with no additional message
-
healthy
Returns a healthyHealthCheck.Result
with an additional message.- Parameters:
message
- an informative message- Returns:
- a healthy
HealthCheck.Result
with an additional message
-
healthy
Returns a healthyHealthCheck.Result
with a formatted message. Message formatting follows the same rules asString.format(String, Object...)
.- Parameters:
message
- a message formatargs
- the arguments apply to the message format- Returns:
- a healthy
HealthCheck.Result
with an additional message - See Also:
-
unhealthy
Returns an unhealthyHealthCheck.Result
with the given message.- Parameters:
message
- an informative message describing how the health check failed- Returns:
- an unhealthy
HealthCheck.Result
with the given message
-
unhealthy
Returns an unhealthyHealthCheck.Result
with a formatted message. Message formatting follows the same rules asString.format(String, Object...)
.- Parameters:
message
- a message formatargs
- the arguments apply to the message format- Returns:
- an unhealthy
HealthCheck.Result
with an additional message - See Also:
-
unhealthy
Returns an unhealthyHealthCheck.Result
with the given error.- Parameters:
error
- an exception thrown during the health check- Returns:
- an unhealthy
HealthCheck.Result
with the given error
-
isHealthy
public boolean isHealthy()Returnstrue
if the result indicates the component is healthy;false
otherwise.- Returns:
true
if the result indicates the component is healthy
-
getMessage
Returns any additional message for the result, ornull
if the result has no message.- Returns:
- any additional message for the result, or
null
-
getError
Returns any exception for the result, ornull
if the result has no exception.- Returns:
- any exception for the result, or
null
-
equals
-
hashCode
public int hashCode() -
toString
-