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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GracefulDegradation.Configdefaults()Default configuration: 5 failures, 30s recovery window, 10s health check interval.final booleanIndicates whether some other object is "equal to" this one.intReturns the value of thefailureThresholdrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thehealthCheckIntervalrecord component.Returns the value of therecoveryWindowrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Config
-
-
Method Details
-
defaults
Default configuration: 5 failures, 30s recovery window, 10s health check interval. 默认配置:5 次失败,30 秒恢复窗口,10 秒健康检查间隔。- Returns:
- the default config | 默认配置
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
failureThreshold
public int failureThreshold()Returns the value of thefailureThresholdrecord component.- Returns:
- the value of the
failureThresholdrecord component
-
recoveryWindow
Returns the value of therecoveryWindowrecord component.- Returns:
- the value of the
recoveryWindowrecord component
-
healthCheckInterval
Returns the value of thehealthCheckIntervalrecord component.- Returns:
- the value of the
healthCheckIntervalrecord component
-