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:
  • HealthCheckHandler
  • StatusAggregator
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    EurekaHealthCheckHandler(org.springframework.boot.actuate.health.StatusAggregator statusAggregator)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected com.netflix.appinfo.InstanceInfo.InstanceStatus
     
    int
     
    com.netflix.appinfo.InstanceInfo.InstanceStatus
    getStatus(com.netflix.appinfo.InstanceInfo.InstanceStatus instanceStatus)
     
    protected org.springframework.boot.actuate.health.Status
    getStatus(org.springframework.boot.actuate.health.StatusAggregator statusAggregator)
     
    boolean
     
    protected com.netflix.appinfo.InstanceInfo.InstanceStatus
    mapToInstanceStatus(org.springframework.boot.actuate.health.Status status)
     
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
     
    void
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • getStatus

      public com.netflix.appinfo.InstanceInfo.InstanceStatus getStatus(com.netflix.appinfo.InstanceInfo.InstanceStatus instanceStatus)
      Specified by:
      getStatus in interface com.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:
      getOrder in interface org.springframework.core.Ordered
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle