Package com.google.api.gax.longrunning
Class OperationTimedPollAlgorithm
java.lang.Object
com.google.api.gax.retrying.ExponentialRetryAlgorithm
com.google.api.gax.longrunning.OperationTimedPollAlgorithm
- All Implemented Interfaces:
TimedRetryAlgorithm,TimedRetryAlgorithmWithContext
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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic OperationTimedPollAlgorithmcreate(RetrySettings globalSettings) Creates the polling algorithm, using the defaultNanoClockfor time computations.static OperationTimedPollAlgorithmcreate(RetrySettings globalSettings, ApiClock clock) booleanshouldRetry(TimedAttemptSettings nextAttemptSettings) Returnstrueif another poll operation should be made or throwsCancellationExceptionotherwise.protected booleanshouldRPCTerminate(long timeLeftMs) Methods inherited from class com.google.api.gax.retrying.ExponentialRetryAlgorithm
createFirstAttempt, createFirstAttempt, createNextAttempt, createNextAttempt, nextRandomLong, shouldRetry
-
Method Details
-
create
Creates the polling algorithm, using the defaultNanoClockfor time computations.- Parameters:
globalSettings- the settings- Returns:
- timed poll algorithm
-
create
-
shouldRetry
Returnstrueif another poll operation should be made or throwsCancellationExceptionotherwise.- Specified by:
shouldRetryin interfaceTimedRetryAlgorithm- Overrides:
shouldRetryin classExponentialRetryAlgorithm- Parameters:
nextAttemptSettings- attempt settings, which will be used for the next attempt, if accepted- Returns:
trueif more attempts should be made, never returnsfalse(throwsCancellationExceptioninstead)- Throws:
CancellationException- if no more attempts should be made
-
shouldRPCTerminate
- Overrides:
shouldRPCTerminatein classExponentialRetryAlgorithm
-