Class OperationTimedPollAlgorithm (2.8.1)

public class OperationTimedPollAlgorithm extends ExponentialRetryAlgorithm

Operation timed polling algorithm, which uses exponential backoff factor for determining when the next polling operation should be executed. If the polling exceeds the total timeout this algorithm cancels polling.

Inheritance

java.lang.Object > ExponentialRetryAlgorithm > OperationTimedPollAlgorithm

Methods

create(RetrySettings globalSettings)

public static OperationTimedPollAlgorithm create(RetrySettings globalSettings)

Creates the polling algorithm, using the default NanoClock for time computations.

Parameter
NameDescription
globalSettingsRetrySettings

the settings

Returns
TypeDescription
OperationTimedPollAlgorithm

timed poll algorithm

create(RetrySettings globalSettings, ApiClock clock)

public static OperationTimedPollAlgorithm create(RetrySettings globalSettings, ApiClock clock)
Parameters
NameDescription
globalSettingsRetrySettings
clockcom.google.api.core.ApiClock
Returns
TypeDescription
OperationTimedPollAlgorithm

shouldRetry(TimedAttemptSettings nextAttemptSettings)

public boolean shouldRetry(TimedAttemptSettings nextAttemptSettings)

Returns true if another poll operation should be made or throws CancellationException otherwise.

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 CancellationException instead)

Overrides Exceptions
TypeDescription
CancellationException

if no more attempts should be made