Record Class HealthTracker.HealthProgress<T>

java.lang.Object
java.lang.Record
org.elasticsearch.health.node.tracker.HealthTracker.HealthProgress<T>
Type Parameters:
T - the type that the health tracker returns
Enclosing class:
HealthTracker<T>

public static record HealthTracker.HealthProgress<T>(HealthTracker<T> healthTracker, T previousHealth, T currentHealth) extends Record
A record for storing the previous and current value of a health check. This allows us to be sure no concurrent processes have updated the health check's reference value.
  • Constructor Details

    • HealthProgress

      public HealthProgress(HealthTracker<T> healthTracker, T previousHealth, T currentHealth)
      Creates an instance of a HealthProgress record class.
      Parameters:
      healthTracker - the value for the healthTracker record component
      previousHealth - the value for the previousHealth record component
      currentHealth - the value for the currentHealth record component
  • Method Details

    • hasChanged

      public boolean hasChanged()
    • updateRequestBuilder

      public void updateRequestBuilder(UpdateHealthInfoCacheAction.Request.Builder builder)
    • recordProgressIfRelevant

      public void recordProgressIfRelevant()
      Update the reference value of the health tracker with the current health info. See HealthTracker.updateLastReportedHealth(T, T) for more info.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • healthTracker

      public HealthTracker<T> healthTracker()
      Returns the value of the healthTracker record component.
      Returns:
      the value of the healthTracker record component
    • previousHealth

      public T previousHealth()
      Returns the value of the previousHealth record component.
      Returns:
      the value of the previousHealth record component
    • currentHealth

      public T currentHealth()
      Returns the value of the currentHealth record component.
      Returns:
      the value of the currentHealth record component