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.
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 |
|
Exceptions | |
---|---|
Type | Description |
PollException |
if no more attempts should be made |