Package com.google.api.gax.retrying
Interface TimedRetryAlgorithmWithContext
- All Superinterfaces:
TimedRetryAlgorithm
- All Known Implementing Classes:
ExponentialPollAlgorithm,ExponentialRetryAlgorithm,OperationTimedPollAlgorithm
A timed retry algorithm is responsible for the following operations, based on the previous
attempt settings and current time:
- Creating first attempt
TimedAttemptSettings. - Accepting a task for retry so another attempt will be made.
- Canceling retrying process so the related
Futurewill be canceled. - Creating
TimedAttemptSettingsfor each subsequent retry attempt.
RetryingContext that can contain specific
RetrySettings and retryable codes that should be used to determine the retry behavior.
Implementations of this interface must be be thread-save.
-
Method Summary
Modifier and TypeMethodDescriptioncreateFirstAttempt(RetryingContext context) Creates a first attemptTimedAttemptSettings.createNextAttempt(RetryingContext context, TimedAttemptSettings previousSettings) Creates a next attemptTimedAttemptSettings, which defines properties of the next attempt.booleanshouldRetry(RetryingContext context, TimedAttemptSettings nextAttemptSettings) Returnstrueif another attempt should be made, orfalseotherwise.Methods inherited from interface com.google.api.gax.retrying.TimedRetryAlgorithm
createFirstAttempt, createNextAttempt, shouldRetry
-
Method Details
-
createFirstAttempt
Creates a first attemptTimedAttemptSettings.- Parameters:
context- aRetryingContextthat can contain customRetrySettingsand retryable codes- Returns:
- first attempt settings
-
createNextAttempt
TimedAttemptSettings createNextAttempt(RetryingContext context, TimedAttemptSettings previousSettings) Creates a next attemptTimedAttemptSettings, which defines properties of the next attempt.- Parameters:
context- aRetryingContextthat can contain customRetrySettingsand retryable codespreviousSettings- previous attempt settings- Returns:
- next attempt settings or
nullif the implementing algorithm does not provide specific settings for the next attempt
-
shouldRetry
Returnstrueif another attempt should be made, orfalseotherwise.- Parameters:
context- aRetryingContextthat can contain customRetrySettingsand retryable codes.nextAttemptSettings- attempt settings, which will be used for the next attempt, if accepted- Throws:
CancellationException- if the retrying process should be canceled
-