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
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OperationTimedPollAlgorithmcreate(RetrySettings globalSettings)Creates the polling algorithm, using the defaultNanoClockfor time computations.static OperationTimedPollAlgorithmcreate(RetrySettings globalSettings, com.google.api.core.ApiClock clock)booleanshouldRetry(TimedAttemptSettings nextAttemptSettings)Returnstrueif another poll operation should be made or throwsCancellationExceptionotherwise.-
Methods inherited from class com.google.api.gax.retrying.ExponentialRetryAlgorithm
createFirstAttempt, createFirstAttempt, createNextAttempt, createNextAttempt, nextRandomLong, shouldRetry
-
-
-
-
Method Detail
-
create
public static OperationTimedPollAlgorithm create(RetrySettings globalSettings)
Creates the polling algorithm, using the defaultNanoClockfor time computations.- Parameters:
globalSettings- the settings- Returns:
- timed poll algorithm
-
create
public static OperationTimedPollAlgorithm create(RetrySettings globalSettings, com.google.api.core.ApiClock clock)
-
shouldRetry
public boolean shouldRetry(TimedAttemptSettings nextAttemptSettings) throws java.util.concurrent.CancellationException
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:
java.util.concurrent.CancellationException- if no more attempts should be made
-
-