Record Class HaPolicy

java.lang.Object
java.lang.Record
org.j7m.middleware.ha.HaPolicy
Record Components:
preferLocal - whether local candidates should be preferred
enableHpSelection - whether HP scoring should be used
benchmarkTtlMillis - benchmark result cache TTL

public record HaPolicy(boolean preferLocal, boolean enableHpSelection, long benchmarkTtlMillis) extends Record
High-availability and high-performance selection policy marker.

The core runtime implements basic HA proxy behavior directly above the registry and transport SPI. This record keeps the HA module explicit for later selector/statistics expansion.

  • Constructor Details

    • HaPolicy

      public HaPolicy(boolean preferLocal)
      Creates a compatibility policy with local preference and HP enabled.
      Parameters:
      preferLocal - whether local candidates should be preferred
    • HaPolicy

      public HaPolicy(boolean preferLocal, boolean enableHpSelection, long benchmarkTtlMillis)
      Creates an instance of a HaPolicy record class.
      Parameters:
      preferLocal - the value for the preferLocal record component
      enableHpSelection - the value for the enableHpSelection record component
      benchmarkTtlMillis - the value for the benchmarkTtlMillis record component
  • Method Details

    • defaults

      public static HaPolicy defaults()
      Returns the default policy.
      Returns:
      default policy
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • preferLocal

      public boolean preferLocal()
      Returns the value of the preferLocal record component.
      Returns:
      the value of the preferLocal record component
    • enableHpSelection

      public boolean enableHpSelection()
      Returns the value of the enableHpSelection record component.
      Returns:
      the value of the enableHpSelection record component
    • benchmarkTtlMillis

      public long benchmarkTtlMillis()
      Returns the value of the benchmarkTtlMillis record component.
      Returns:
      the value of the benchmarkTtlMillis record component