类 RetryUtils
java.lang.Object
dev.langchain4j.internal.RetryUtils
Utility class for retrying actions.
-
嵌套类概要
嵌套类 -
字段概要
字段 -
方法概要
修饰符和类型方法说明This method returns a RetryPolicy.Builder.static <T> TThis method attempts to execute a given action up to a specified number of times with a 1-second delay.static <T> TThis method attempts to execute a given action up to a specified number of times with a 1-second delay.
-
字段详细资料
-
DEFAULT_RETRY_POLICY
Default retry policy used bywithRetry(Callable).
-
-
方法详细资料
-
retryPolicyBuilder
This method returns a RetryPolicy.Builder.- 返回:
- A RetryPolicy.Builder.
-
withRetry
This method attempts to execute a given action up to a specified number of times with a 1-second delay. If the action fails on all attempts, it throws a RuntimeException.- 类型参数:
T- The type of the result of the action.- 参数:
action- The action to be executed.maxAttempts- The maximum number of attempts to execute the action.- 返回:
- The result of the action if it is successful.
- 抛出:
RuntimeException- if the action fails on all attempts.
-
withRetry
This method attempts to execute a given action up to a specified number of times with a 1-second delay. If the action fails on all attempts, it throws a RuntimeException.- 类型参数:
T- The type of the result of the action.- 参数:
action- The action to be executed.- 返回:
- The result of the action if it is successful.
- 抛出:
RuntimeException- if the action fails on all attempts.
-