Class OperationTimedPollAlgorithm (2.72.1)

publicclass OperationTimedPollAlgorithmextendsExponentialRetryAlgorithm

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

Static Methods

create(RetrySettings globalSettings)

publicstaticOperationTimedPollAlgorithmcreate(RetrySettingsglobalSettings)

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

Parameter
Name Description
globalSettings RetrySettings

the settings

Returns
Type Description
OperationTimedPollAlgorithm

timed poll algorithm

create(RetrySettings globalSettings, ApiClock clock)

publicstaticOperationTimedPollAlgorithmcreate(RetrySettingsglobalSettings,ApiClockclock)
Parameters
Name Description
globalSettings RetrySettings
clock ApiClock
Returns
Type Description
OperationTimedPollAlgorithm

Methods

shouldRPCTerminate(long timeLeftMs)

protectedbooleanshouldRPCTerminate(longtimeLeftMs)
Parameter
Name Description
timeLeftMs long
Returns
Type Description
boolean
Overrides

shouldRetry(TimedAttemptSettings nextAttemptSettings)

publicbooleanshouldRetry(TimedAttemptSettingsnextAttemptSettings)

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

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

Overrides
Exceptions
Type Description
CancellationException

if no more attempts should be made

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.