Record Class GracefulDegradation.Stats

java.lang.Object
java.lang.Record
cloud.opencode.base.cache.resilience.GracefulDegradation.Stats
Record Components:
totalRequests - total cache requests processed | 处理的缓存请求总数
degradedRequests - requests served in degraded mode | 降级模式下服务的请求数
failoverCount - times the system entered DEGRADED | 系统进入 DEGRADED 的次数
currentState - the current degradation state | 当前降级状态
lastFailover - timestamp of the last failover (nullable) | 最后故障转移的时间戳(可空)
Enclosing class:
GracefulDegradation<K,V>

public static record GracefulDegradation.Stats(long totalRequests, long degradedRequests, long failoverCount, GracefulDegradation.State currentState, Instant lastFailover) extends Record
Snapshot of degradation system statistics. 降级系统统计信息的快照。
Since:
JDK 25, opencode-base-cache V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • Stats

      public Stats(long totalRequests, long degradedRequests, long failoverCount, GracefulDegradation.State currentState, Instant lastFailover)
      Creates an instance of a Stats record class.
      Parameters:
      totalRequests - the value for the totalRequests record component
      degradedRequests - the value for the degradedRequests record component
      failoverCount - the value for the failoverCount record component
      currentState - the value for the currentState record component
      lastFailover - the value for the lastFailover record component
  • Method Details

    • 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.
    • totalRequests

      public long totalRequests()
      Returns the value of the totalRequests record component.
      Returns:
      the value of the totalRequests record component
    • degradedRequests

      public long degradedRequests()
      Returns the value of the degradedRequests record component.
      Returns:
      the value of the degradedRequests record component
    • failoverCount

      public long failoverCount()
      Returns the value of the failoverCount record component.
      Returns:
      the value of the failoverCount record component
    • currentState

      public GracefulDegradation.State currentState()
      Returns the value of the currentState record component.
      Returns:
      the value of the currentState record component
    • lastFailover

      public Instant lastFailover()
      Returns the value of the lastFailover record component.
      Returns:
      the value of the lastFailover record component