Interface RetryContext
public interface RetryContext
Context of an invocation attempt handled by
Retry.
The first attempt has an attempt number of 1, a previous delay of Duration.ZERO, and no previous
throwable. Each subsequent attempt provides the delay preceding that attempt and the throwable from the previous
attempt. The context is created immediately before invoking the function for an attempt.
-
Method Summary
Modifier and TypeMethodDescriptionintattempt()Number of the current invocation attempt.Time elapsed since the retry invocation started when this attempt began.Requested delay preceding this attempt.Throwable from the preceding attempt.
-
Method Details
-
attempt
int attempt()Number of the current invocation attempt.- Returns:
- 1-based invocation attempt number
-
elapsedTime
Duration elapsedTime()Time elapsed since the retry invocation started when this attempt began.- Returns:
- elapsed time
-
previousDelay
Duration previousDelay()Requested delay preceding this attempt.The value is
Duration.ZEROfor the initial attempt.- Returns:
- requested delay preceding this attempt
-
previousThrowable
-