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 health and can retrieve the current health status when requested.
  • Constructor Details

    • HealthTracker

      public HealthTracker()
  • Method Details

    • determineCurrentHealth

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

      protected 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.
    • addToRequestBuilder

      public void addToRequestBuilder(UpdateHealthInfoCacheAction.Request.Builder builder)
      Add the last reported health to the request builder.
    • checkHealthChanged

      public boolean checkHealthChanged()
      Determine the current health info for this tracker and check if it has changed from the last reported value. When the health has changed, we'll store the new health as the last reported value.
      Returns:
      whether the health has changed.
    • reset

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

      public T getLastDeterminedHealth()