Record Class GracefulDegradation.Config

java.lang.Object
java.lang.Record
cloud.opencode.base.cache.resilience.GracefulDegradation.Config
Record Components:
failureThreshold - consecutive failures before entering DEGRADED | 进入 DEGRADED 前的连续失败次数
recoveryWindow - duration to remain in RECOVERING before NORMAL | 从 RECOVERING 过渡到 NORMAL 前的持续时间
healthCheckInterval - interval between health check probes in DEGRADED | DEGRADED 中健康检查探测的间隔
Enclosing class:
GracefulDegradation<K,V>

public static record GracefulDegradation.Config(int failureThreshold, Duration recoveryWindow, Duration healthCheckInterval) extends Record
Configuration for graceful degradation behavior. 优雅降级行为的配置。
Since:
JDK 25, opencode-base-cache V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • Config

      public Config(int failureThreshold, Duration recoveryWindow, Duration healthCheckInterval)
      Compact canonical constructor with validation.
  • Method Details

    • defaults

      public static GracefulDegradation.Config defaults()
      Default configuration: 5 failures, 30s recovery window, 10s health check interval. 默认配置:5 次失败,30 秒恢复窗口,10 秒健康检查间隔。
      Returns:
      the default config | 默认配置
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • failureThreshold

      public int failureThreshold()
      Returns the value of the failureThreshold record component.
      Returns:
      the value of the failureThreshold record component
    • recoveryWindow

      public Duration recoveryWindow()
      Returns the value of the recoveryWindow record component.
      Returns:
      the value of the recoveryWindow record component
    • healthCheckInterval

      public Duration healthCheckInterval()
      Returns the value of the healthCheckInterval record component.
      Returns:
      the value of the healthCheckInterval record component