public final class Health extends Object
Health
contains a Status
to express the state of a component or
subsystem and some additional details to carry some contextual information.
Health
instances can be created by using Health.Builder
's fluent API. Typical
usage in a HealthIndicator
would be:
try { // do some test to determine state of component return new Health.Builder().up().withDetail("version", "1.1.2").build(); } catch (Exception ex) { return new Health.Builder().down(ex).build(); }
Modifier and Type | Class and Description |
---|---|
static class |
Health.Builder
Builder for creating immutable
Health instances. |
Modifier and Type | Method and Description |
---|---|
static Health.Builder |
down()
Create a new
Health.Builder instance with a Status.DOWN status. |
static Health.Builder |
down(Exception ex)
Create a new
Health.Builder instance with an Status.DOWN status an the
specified exception details. |
boolean |
equals(Object obj) |
Map<String,Object> |
getDetails() |
Status |
getStatus() |
int |
hashCode() |
static Health.Builder |
outOfService()
Create a new
Health.Builder instance with an Status.OUT_OF_SERVICE status. |
static Health.Builder |
status(Status status)
Create a new
Health.Builder instance with a specific Status . |
static Health.Builder |
status(String statusCode)
Create a new
Health.Builder instance with a specific status code. |
String |
toString() |
static Health.Builder |
unknown()
Create a new
Health.Builder instance with an Status.UNKNOWN status. |
static Health.Builder |
up()
Create a new
Health.Builder instance with an Status.UP status. |
public Status getStatus()
null
)public Map<String,Object> getDetails()
public static Health.Builder unknown()
Health.Builder
instance with an Status.UNKNOWN
status.Health.Builder
instancepublic static Health.Builder up()
Health.Builder
instance with an Status.UP
status.Health.Builder
instancepublic static Health.Builder down(Exception ex)
Health.Builder
instance with an Status.DOWN
status an the
specified exception details.ex
- the exceptionHealth.Builder
instancepublic static Health.Builder down()
Health.Builder
instance with a Status.DOWN
status.Health.Builder
instancepublic static Health.Builder outOfService()
Health.Builder
instance with an Status.OUT_OF_SERVICE
status.Health.Builder
instancepublic static Health.Builder status(String statusCode)
Health.Builder
instance with a specific status code.Health.Builder
instancepublic static Health.Builder status(Status status)
Health.Builder
instance with a specific Status
.Health.Builder
instanceCopyright © 2014 Pivotal Software, Inc.. All rights reserved.