public class ExponentialPollAlgorithm extends ExponentialRetryAlgorithm
PollException in case if total timeout or total number of
attempts is reached.
This class is thread-safe.
| Constructor and Description |
|---|
ExponentialPollAlgorithm(RetrySettings globalSettings,
com.google.api.core.ApiClock clock)
Creates a new exponential poll algorithm instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
shouldRetry(TimedAttemptSettings nextAttemptSettings)
Returns
true if another poll operation should be made or throws PollException,
if either total timeout or total number of attempts is exceeded. |
createFirstAttempt, createFirstAttempt, createNextAttempt, createNextAttempt, nextRandomLong, shouldRetrypublic ExponentialPollAlgorithm(RetrySettings globalSettings, com.google.api.core.ApiClock clock)
globalSettings - global poll settings (attempt independent)clock - clock to use for time-specific calculationsNullPointerException - if either globalSettings or clock is nullpublic boolean shouldRetry(TimedAttemptSettings nextAttemptSettings) throws PollException
true if another poll operation should be made or throws PollException,
if either total timeout or total number of attempts is exceeded.shouldRetry in interface TimedRetryAlgorithmshouldRetry in class ExponentialRetryAlgorithmnextAttemptSettings - attempt settings, which will be used for the next attempt, if
acceptedtrue if more attempts should be made, never returns false (throws
PollException instead)PollException - if no more attempts should be made