Class BasicResultRetryAlgorithm<ResponseT> (2.20.0)

public class BasicResultRetryAlgorithm<ResponseT> implements ResultRetryAlgorithmWithContext<ResponseT>

A basic implementation of ResultRetryAlgorithm. Using this implementation would mean that all exceptions should be retried, all responses should be accepted (including null) and no retrying process should ever be canceled.

Inheritance

java.lang.Object > BasicResultRetryAlgorithm<ResponseT>

Implements

com.google.api.gax.retrying.ResultRetryAlgorithmWithContext<ResponseT>

Type Parameter

NameDescription
ResponseT

Constructors

BasicResultRetryAlgorithm()

public BasicResultRetryAlgorithm()

Methods

createNextAttempt(RetryingContext context, Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)

public TimedAttemptSettings createNextAttempt(RetryingContext context, Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)

Always returns null, indicating that this algorithm does not provide any specific settings for the next attempt.

Parameters
NameDescription
contextRetryingContext
previousThrowableThrowable
previousResponseResponseT
previousSettingsTimedAttemptSettings
Returns
TypeDescription
TimedAttemptSettings

createNextAttempt(Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)

public TimedAttemptSettings createNextAttempt(Throwable previousThrowable, ResponseT previousResponse, TimedAttemptSettings previousSettings)

Always returns null, indicating that this algorithm does not provide any specific settings for the next attempt.

Parameters
NameDescription
previousThrowableThrowable
previousResponseResponseT
previousSettingsTimedAttemptSettings
Returns
TypeDescription
TimedAttemptSettings

shouldRetry(RetryingContext context, Throwable previousThrowable, ResponseT previousResponse)

public boolean shouldRetry(RetryingContext context, Throwable previousThrowable, ResponseT previousResponse)

Returns true if an exception was thrown (previousThrowable != null), false otherwise.

Parameters
NameDescription
contextRetryingContext
previousThrowableThrowable
previousResponseResponseT
Returns
TypeDescription
boolean
Exceptions
TypeDescription
CancellationException

shouldRetry(Throwable previousThrowable, ResponseT previousResponse)

public boolean shouldRetry(Throwable previousThrowable, ResponseT previousResponse)

Returns true if an exception was thrown (previousThrowable != null), false otherwise.

Parameters
NameDescription
previousThrowableThrowable
previousResponseResponseT
Returns
TypeDescription
boolean