Record Class BackoffStrategy.Fibonacci
java.lang.Object
java.lang.Record
cloud.opencode.base.core.retry.BackoffStrategy.Fibonacci
- Record Components:
initialDelay- the initial delay (first two Fibonacci values) - 初始延迟(前两个斐波那契值)
- All Implemented Interfaces:
BackoffStrategy
- Enclosing interface:
BackoffStrategy
public static record BackoffStrategy.Fibonacci(Duration initialDelay)
extends Record
implements BackoffStrategy
Fibonacci backoff - delay follows the Fibonacci sequence.
斐波那契退避 - 延迟按斐波那契数列增长。
- Since:
- JDK 25, opencode-base-core V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface BackoffStrategy
BackoffStrategy.Exponential, BackoffStrategy.ExponentialWithJitter, BackoffStrategy.Fibonacci, BackoffStrategy.Fixed -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondelay(int attempt) Calculate the delay for the given attempt number.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theinitialDelayrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Fibonacci
Creates an instance of aFibonaccirecord class.- Parameters:
initialDelay- the value for theinitialDelayrecord component
-
-
Method Details
-
delay
Description copied from interface:BackoffStrategyCalculate the delay for the given attempt number. 计算给定重试次数的延迟。- Specified by:
delayin interfaceBackoffStrategy- Parameters:
attempt- attempt number, starting from 1 - 重试次数,从1开始- Returns:
- the delay duration - 延迟时长
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
initialDelay
Returns the value of theinitialDelayrecord component.- Returns:
- the value of the
initialDelayrecord component
-