T
- The health indication typepublic abstract class AbstractHealthIndicator<T> extends java.lang.Object implements HealthIndicator
A base health indicator class to extend from that catches exceptions thrown from the
getHealthInformation()
method and updates the HealthResult
with the exception information.
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.ExecutorService |
executorService |
protected HealthStatus |
healthStatus |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
AbstractHealthIndicator() |
Modifier and Type | Method and Description |
---|---|
protected abstract T |
getHealthInformation()
Provides information (typically a Map) to be returned.
|
protected HealthResult |
getHealthResult()
Builds the whole health result.
|
protected abstract java.lang.String |
getName()
Used to populate the
HealthResult . |
org.reactivestreams.Publisher<HealthResult> |
getResult() |
void |
setExecutorService(java.util.concurrent.ExecutorService executorService) |
protected java.util.concurrent.ExecutorService executorService
protected HealthStatus healthStatus
@Inject public void setExecutorService(@Named(value="io") java.util.concurrent.ExecutorService executorService)
executorService
- The executor servicepublic org.reactivestreams.Publisher<HealthResult> getResult()
getResult
in interface HealthIndicator
HealthResult
that provides the
information necessary to build a response.protected abstract T getHealthInformation()
healthStatus
field during execution,
otherwise HealthStatus.UNKNOWN
will be used.protected HealthResult getHealthResult()
protected abstract java.lang.String getName()
HealthResult
. Provides a key to go along with the health information.