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 Summary
ConstructorsConstructorDescriptionStats(long totalRequests, long degradedRequests, long failoverCount, GracefulDegradation.State currentState, Instant lastFailover) Creates an instance of aStatsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecurrentStaterecord component.longReturns the value of thedegradedRequestsrecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of thefailoverCountrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thelastFailoverrecord component.final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalRequestsrecord component.
-
Constructor Details
-
Stats
public Stats(long totalRequests, long degradedRequests, long failoverCount, GracefulDegradation.State currentState, Instant lastFailover) Creates an instance of aStatsrecord class.- Parameters:
totalRequests- the value for thetotalRequestsrecord componentdegradedRequests- the value for thedegradedRequestsrecord componentfailoverCount- the value for thefailoverCountrecord componentcurrentState- the value for thecurrentStaterecord componentlastFailover- the value for thelastFailoverrecord component
-
-
Method Details
-
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. -
totalRequests
public long totalRequests()Returns the value of thetotalRequestsrecord component.- Returns:
- the value of the
totalRequestsrecord component
-
degradedRequests
public long degradedRequests()Returns the value of thedegradedRequestsrecord component.- Returns:
- the value of the
degradedRequestsrecord component
-
failoverCount
public long failoverCount()Returns the value of thefailoverCountrecord component.- Returns:
- the value of the
failoverCountrecord component
-
currentState
Returns the value of thecurrentStaterecord component.- Returns:
- the value of the
currentStaterecord component
-
lastFailover
Returns the value of thelastFailoverrecord component.- Returns:
- the value of the
lastFailoverrecord component
-