Class EurekaHealthCheckHandler
java.lang.Object
org.springframework.cloud.netflix.eureka.EurekaHealthCheckHandler
- All Implemented Interfaces:
com.netflix.appinfo.HealthCheckHandler,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.core.Ordered
public class EurekaHealthCheckHandler
extends Object
implements com.netflix.appinfo.HealthCheckHandler, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, org.springframework.context.Lifecycle
A Eureka health checker, maps the application status into
InstanceInfo.InstanceStatus that
will be propagated to Eureka registry.
On each heartbeat Eureka performs the health check invoking registered
HealthCheckHandler. By default this implementation will perform aggregation of
all registered HealthIndicator through registered StatusAggregator.
A null status is returned when the application context is closed (or in the
process of being closed). This prevents Eureka from updating the health status and only
consider the status present in the current InstanceInfo.- Author:
- Jakub Narloch, Spencer Gibb, Nowrin Anwar Joyita, Bertrand Renuart, Olga Maciaszek-Sharma
- See Also:
-
HealthCheckHandlerStatusAggregator
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionEurekaHealthCheckHandler(org.springframework.boot.actuate.health.StatusAggregator statusAggregator) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected com.netflix.appinfo.InstanceInfo.InstanceStatusintgetOrder()com.netflix.appinfo.InstanceInfo.InstanceStatusgetStatus(com.netflix.appinfo.InstanceInfo.InstanceStatus instanceStatus) protected org.springframework.boot.actuate.health.StatusgetStatus(org.springframework.boot.actuate.health.StatusAggregator statusAggregator) booleanprotected com.netflix.appinfo.InstanceInfo.InstanceStatusmapToInstanceStatus(org.springframework.boot.actuate.health.Status status) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidstart()voidstop()
-
Constructor Details
-
EurekaHealthCheckHandler
public EurekaHealthCheckHandler(org.springframework.boot.actuate.health.StatusAggregator statusAggregator)
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getStatus
public com.netflix.appinfo.InstanceInfo.InstanceStatus getStatus(com.netflix.appinfo.InstanceInfo.InstanceStatus instanceStatus) - Specified by:
getStatusin interfacecom.netflix.appinfo.HealthCheckHandler
-
getHealthStatus
protected com.netflix.appinfo.InstanceInfo.InstanceStatus getHealthStatus() -
getStatus
protected org.springframework.boot.actuate.health.Status getStatus(org.springframework.boot.actuate.health.StatusAggregator statusAggregator) -
mapToInstanceStatus
protected com.netflix.appinfo.InstanceInfo.InstanceStatus mapToInstanceStatus(org.springframework.boot.actuate.health.Status status) -
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-