Package com.google.api.gax.retrying
Class BasicResultRetryAlgorithm<ResponseT>
- java.lang.Object
-
- com.google.api.gax.retrying.BasicResultRetryAlgorithm<ResponseT>
-
- Type Parameters:
ResponseT- attempt response type
- All Implemented Interfaces:
ResultRetryAlgorithm<ResponseT>,ResultRetryAlgorithmWithContext<ResponseT>
public class BasicResultRetryAlgorithm<ResponseT> extends java.lang.Object implements ResultRetryAlgorithmWithContext<ResponseT>
A basic implementation ofResultRetryAlgorithm. Using this implementation would mean that all exceptions should be retried, all responses should be accepted (includingnull) and no retrying process should ever be canceled.
-
-
Constructor Summary
Constructors Constructor Description BasicResultRetryAlgorithm()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimedAttemptSettingscreateNextAttempt(RetryingContext context, java.lang.Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)Always returns null, indicating that this algorithm does not provide any specific settings for the next attempt.TimedAttemptSettingscreateNextAttempt(java.lang.Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)Always returns null, indicating that this algorithm does not provide any specific settings for the next attempt.booleanshouldRetry(RetryingContext context, java.lang.Throwable previousThrowable, ResponseT previousResponse)Returnstrueif an exception was thrown (previousThrowable != null),falseotherwise.booleanshouldRetry(java.lang.Throwable previousThrowable, ResponseT previousResponse)Returnstrueif an exception was thrown (previousThrowable != null),falseotherwise.
-
-
-
Method Detail
-
createNextAttempt
public TimedAttemptSettings createNextAttempt(java.lang.Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)
Always returns null, indicating that this algorithm does not provide any specific settings for the next attempt.- Specified by:
createNextAttemptin interfaceResultRetryAlgorithm<ResponseT>
-
createNextAttempt
public TimedAttemptSettings createNextAttempt(RetryingContext context, java.lang.Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)
Always returns null, indicating that this algorithm does not provide any specific settings for the next attempt.- Specified by:
createNextAttemptin interfaceResultRetryAlgorithmWithContext<ResponseT>- Parameters:
context- the retrying context of this invocation that can be used to determine the settings for the next attempt.previousThrowable- exception thrown by the previous attempt (null, if none)previousResponse- response returned by the previous attemptpreviousSettings- previous attempt settings
-
shouldRetry
public boolean shouldRetry(java.lang.Throwable previousThrowable, ResponseT previousResponse)Returnstrueif an exception was thrown (previousThrowable != null),falseotherwise.- Specified by:
shouldRetryin interfaceResultRetryAlgorithm<ResponseT>
-
shouldRetry
public boolean shouldRetry(RetryingContext context, java.lang.Throwable previousThrowable, ResponseT previousResponse) throws java.util.concurrent.CancellationException
Returnstrueif an exception was thrown (previousThrowable != null),falseotherwise.- Specified by:
shouldRetryin interfaceResultRetryAlgorithmWithContext<ResponseT>- Parameters:
context- the retrying context of this invocation that can be used to determine whether the call should be retried.previousThrowable- exception thrown by the previous attempt (null, if none)previousResponse- response returned by the previous attempt.- Throws:
java.util.concurrent.CancellationException
-
-