Record Class CircuitBreaker.Config
java.lang.Object
java.lang.Record
cloud.opencode.base.cache.protection.CircuitBreaker.Config
- Record Components:
failureThreshold- failures to trigger open | 触发打开的失败次数openDuration- time to stay open | 保持打开的时间halfOpenRequests- requests allowed in half-open | 半开状态允许的请求数failureRateThreshold- failure rate to trigger open | 触发打开的失败率
- Enclosing class:
CircuitBreaker
public static record CircuitBreaker.Config(int failureThreshold, Duration openDuration, int halfOpenRequests, double failureRateThreshold)
extends Record
Circuit breaker configuration
熔断器配置
- Since:
- JDK 25, opencode-base-cache V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classpublic static class Builder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()builder | builderfinal booleanIndicates whether some other object is "equal to" this one.doubleReturns the value of thefailureRateThresholdrecord component.intReturns the value of thefailureThresholdrecord component.intReturns the value of thehalfOpenRequestsrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theopenDurationrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Config
public Config(int failureThreshold, Duration openDuration, int halfOpenRequests, double failureRateThreshold) Creates an instance of aConfigrecord class.- Parameters:
failureThreshold- the value for thefailureThresholdrecord componentopenDuration- the value for theopenDurationrecord componenthalfOpenRequests- the value for thehalfOpenRequestsrecord componentfailureRateThreshold- the value for thefailureRateThresholdrecord component
-
-
Method Details
-
builder
-
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
-
openDuration
Returns the value of theopenDurationrecord component.- Returns:
- the value of the
openDurationrecord component
-
halfOpenRequests
public int halfOpenRequests()Returns the value of thehalfOpenRequestsrecord component.- Returns:
- the value of the
halfOpenRequestsrecord component
-
failureRateThreshold
public double failureRateThreshold()Returns the value of thefailureRateThresholdrecord component.- Returns:
- the value of the
failureRateThresholdrecord component
-