Class ExponentialPollAlgorithm (2.13.0)

public class ExponentialPollAlgorithm extends ExponentialRetryAlgorithm

The timed poll algorithm which uses jittered exponential backoff factor for calculating the next poll execution time and throws PollException in case if total timeout or total number of attempts is reached.

This class is thread-safe.

Inheritance

java.lang.Object > ExponentialRetryAlgorithm > ExponentialPollAlgorithm

Constructors

ExponentialPollAlgorithm(RetrySettings globalSettings, ApiClock clock)

public ExponentialPollAlgorithm(RetrySettings globalSettings, ApiClock clock)

Creates a new exponential poll algorithm instance.

Parameters
NameDescription
globalSettingsRetrySettings

global poll settings (attempt independent)

clockcom.google.api.core.ApiClock

clock to use for time-specific calculations

Methods

shouldRetry(TimedAttemptSettings nextAttemptSettings)

public 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.

Parameter
NameDescription
nextAttemptSettingsTimedAttemptSettings

attempt settings, which will be used for the next attempt, if accepted

Returns
TypeDescription
boolean

true if more attempts should be made, never returns false (throws PollException instead)

Overrides Exceptions
TypeDescription
PollException

if no more attempts should be made