Package com.google.api.gax.retrying
Interface TimedRetryAlgorithmWithContext
-
- All Superinterfaces:
TimedRetryAlgorithm
- All Known Implementing Classes:
ExponentialPollAlgorithm,ExponentialRetryAlgorithm,OperationTimedPollAlgorithm
public interface TimedRetryAlgorithmWithContext extends TimedRetryAlgorithm
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.
RetryingContextthat can contain specificRetrySettingsand retryable codes that should be used to determine the retry behavior.Implementations of this interface must be be thread-save.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TimedAttemptSettingscreateFirstAttempt(RetryingContext context)Creates a first attemptTimedAttemptSettings.TimedAttemptSettingscreateNextAttempt(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 Detail
-
createFirstAttempt
TimedAttemptSettings createFirstAttempt(RetryingContext context)
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
boolean shouldRetry(RetryingContext context, TimedAttemptSettings nextAttemptSettings)
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
-
-