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
  • Constructor Details

    • Config

      public Config(int failureThreshold, Duration openDuration, int halfOpenRequests, double failureRateThreshold)
      Creates an instance of a Config record class.
      Parameters:
      failureThreshold - the value for the failureThreshold record component
      openDuration - the value for the openDuration record component
      halfOpenRequests - the value for the halfOpenRequests record component
      failureRateThreshold - the value for the failureRateThreshold record component
  • Method Details

    • builder

      public static CircuitBreaker.Config.Builder builder()
      builder | builder
      Returns:
      the result | 结果
    • 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
    • openDuration

      public Duration openDuration()
      Returns the value of the openDuration record component.
      Returns:
      the value of the openDuration record component
    • halfOpenRequests

      public int halfOpenRequests()
      Returns the value of the halfOpenRequests record component.
      Returns:
      the value of the halfOpenRequests record component
    • failureRateThreshold

      public double failureRateThreshold()
      Returns the value of the failureRateThreshold record component.
      Returns:
      the value of the failureRateThreshold record component