Class HealthTracker<T>

java.lang.Object
org.elasticsearch.health.node.tracker.HealthTracker<T>
Type Parameters:
T - the type of the health check result they track
Direct Known Subclasses:
DiskHealthTracker, RepositoriesHealthTracker

public abstract class HealthTracker<T> extends Object
Base class for health trackers that will be executed by the LocalHealthMonitor. It keeps track of the last reported value and can retrieve the current health status when requested.
  • Constructor Details

    • HealthTracker

      public HealthTracker()
  • Method Details

    • checkCurrentHealth

      public abstract T checkCurrentHealth()
      Determine the health info for this health check.
      Returns:
      the health info.
    • addToRequestBuilder

      public abstract void addToRequestBuilder(UpdateHealthInfoCacheAction.Request.Builder builder, T healthInfo)
      Add the health info to the request builder.
      Parameters:
      builder - the builder to add the health info to.
      healthInfo - the health info to add.
    • trackHealth

      public HealthTracker.HealthProgress<T> trackHealth()
      Create a new HealthTracker.HealthProgress instance by getting the current last reported value and determining the health info at this time.
      Returns:
      the new HealthTracker.HealthProgress instance.
    • updateLastReportedHealth

      public void updateLastReportedHealth(T previous, T current)
      Update the last reported health info to current, but only when the value inside lastReportedValue is equal to previous.
      Parameters:
      previous - the previous value that should be in lastReportedValue at the time of execution.
      current - the value that should be stored in lastReportedValue.
    • reset

      public void reset()
      Reset the value of lastReportedValue to null. Should be used when, for example, the master or health node has changed.
    • getLastReportedValue

      public T getLastReportedValue()