Class ExponentialPollAlgorithm (2.47.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
Name Description
globalSettings RetrySettings

global poll settings (attempt independent)

clock 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
Name Description
nextAttemptSettings TimedAttemptSettings

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

Returns
Type Description
boolean

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

Overrides
Exceptions
Type Description
PollException

if no more attempts should be made