Class AbstractHealthIndicator<T>
- java.lang.Object
-
- io.micronaut.management.health.indicator.AbstractHealthIndicator<T>
-
- Type Parameters:
T- The health indication type
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,HealthIndicator
- Direct Known Subclasses:
DiskSpaceIndicator
public 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 theHealthResultwith the exception information.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ExecutorServiceexecutorServiceprotected io.micronaut.health.HealthStatushealthStatus
-
Constructor Summary
Constructors Constructor Description AbstractHealthIndicator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TgetHealthInformation()Provides information (typically a Map) to be returned.protected HealthResultgetHealthResult()Builds the whole health result.protected abstract java.lang.StringgetName()Used to populate theHealthResult.org.reactivestreams.Publisher<HealthResult>getResult()voidsetExecutorService(java.util.concurrent.ExecutorService executorService)
-
-
-
Method Detail
-
setExecutorService
@Inject public void setExecutorService(@Named("io") java.util.concurrent.ExecutorService executorService)- Parameters:
executorService- The executor service
-
getResult
public org.reactivestreams.Publisher<HealthResult> getResult()
- Specified by:
getResultin interfaceHealthIndicator- Returns:
- A publisher that returns a
HealthResultthat provides the information necessary to build a response.
-
getHealthInformation
protected abstract T getHealthInformation()
Provides information (typically a Map) to be returned. Set thehealthStatusfield during execution, otherwiseHealthStatus.UNKNOWNwill be used.- Returns:
- Any details to be included in the response.
-
getHealthResult
protected HealthResult getHealthResult()
Builds the whole health result.- Returns:
- The health result to provide to the indicator.
-
getName
protected abstract java.lang.String getName()
Used to populate theHealthResult. Provides a key to go along with the health information.- Returns:
- The name of the indicator
-
-