Class BasicResultRetryAlgorithm<ResponseT> (2.52.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

Name Description
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
Name Description
context RetryingContext
previousThrowable Throwable
previousResponse ResponseT
previousSettings TimedAttemptSettings
Returns
Type Description
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
Name Description
previousThrowable Throwable
previousResponse ResponseT
previousSettings TimedAttemptSettings
Returns
Type Description
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
Name Description
context RetryingContext
previousThrowable Throwable
previousResponse ResponseT
Returns
Type Description
boolean
Exceptions
Type Description
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
Name Description
previousThrowable Throwable
previousResponse ResponseT
Returns
Type Description
boolean