ExponentialBackoffRetryStrategy Classe

public final class ExponentialBackoffRetryStrategy
extends RetryStrategy

Uma estratégia de repetição com parâmetros de retirada para calcular o atraso exponencial entre repetições.

Resumo do campo

Modificador e tipo Campo e descrição
static final int DEFAULT_CLIENT_BACKOFF

Representa a quantidade padrão de tempo usada ao calcular um delta aleatório no atraso exponencial entre novas tentativas.

static final int DEFAULT_MAX_BACKOFF

Representa o tempo máximo padrão usado ao calcular o atraso exponencial entre novas tentativas.

static final int DEFAULT_MIN_BACKOFF

Representa a quantidade mínima padrão de tempo usada ao calcular o atraso exponencial entre novas tentativas.

Resumo do Construtor

Construtor Description
ExponentialBackoffRetryStrategy()

Inicializa uma nova instância da classe ExponentialBackoffRetryStrategy.

ExponentialBackoffRetryStrategy(int retryCount, int minBackoff, int maxBackoff, int deltaBackoff)

Inicializa uma nova instância da classe ExponentialBackoffRetryStrategy.

ExponentialBackoffRetryStrategy(String name, int retryCount, int minBackoff, int maxBackoff, int deltaBackoff, boolean firstFastRetry)

Inicializa uma nova instância da classe ExponentialBackoffRetryStrategy.

Resumo do método

Modificador e tipo Método e descrição
boolean shouldRetry(int retryCount, Response response)

Retorna se uma solicitação deve ser repetida com base na contagem de repetições, na resposta atual e na estratégia atual.

Métodos herdados de RetryStrategy

Métodos herdados de java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Detalhes do campo

DEFAULT_CLIENT_BACKOFF

public static final int DEFAULT_CLIENT_BACKOFF

Representa a quantidade padrão de tempo usada ao calcular um delta aleatório no atraso exponencial entre novas tentativas.

DEFAULT_MAX_BACKOFF

public static final int DEFAULT_MAX_BACKOFF

Representa o tempo máximo padrão usado ao calcular o atraso exponencial entre novas tentativas.

DEFAULT_MIN_BACKOFF

public static final int DEFAULT_MIN_BACKOFF

Representa a quantidade mínima padrão de tempo usada ao calcular o atraso exponencial entre novas tentativas.

Detalhes do construtor

ExponentialBackoffRetryStrategy

public ExponentialBackoffRetryStrategy()

Inicializa uma nova instância da classe ExponentialBackoffRetryStrategy.

ExponentialBackoffRetryStrategy

public ExponentialBackoffRetryStrategy(int retryCount, int minBackoff, int maxBackoff, int deltaBackoff)

Inicializa uma nova instância da classe ExponentialBackoffRetryStrategy.

Parâmetros:

retryCount - O número máximo de tentativas de repetição.
minBackoff - O tempo mínimo de retirada.
maxBackoff - O tempo máximo de retirada.
deltaBackoff - O valor que será usado para calcular um delta aleatório no atraso exponencial entre novas tentativas.

ExponentialBackoffRetryStrategy

public ExponentialBackoffRetryStrategy(String name, int retryCount, int minBackoff, int maxBackoff, int deltaBackoff, boolean firstFastRetry)

Inicializa uma nova instância da classe ExponentialBackoffRetryStrategy.

Parâmetros:

name - O nome da estratégia de repetição.
retryCount - O número máximo de tentativas de repetição.
minBackoff - O tempo mínimo de retirada.
maxBackoff - O tempo máximo de retirada.
deltaBackoff - O valor que será usado para calcular um delta aleatório no atraso exponencial entre novas tentativas.
firstFastRetry - true para tentar novamente imediatamente na primeira tentativa; caso contrário, false. As novas tentativas subsequentes permanecerão sujeitas ao intervalo de repetição configurado.

Detalhes do método

shouldRetry

public boolean shouldRetry(int retryCount, Response response)

Retorna se uma solicitação deve ser repetida com base na contagem de repetições, na resposta atual e na estratégia atual.

Substituições:

ExponentialBackoffRetryStrategy.shouldRetry(int retryCount, Response response)

Parâmetros:

retryCount - A contagem de tentativas de repetição atual.
response - A exceção que causou a ocorrência das condições de repetição.

Retornos:

true se a solicitação deve ser repetida; false caso contrário.

Aplica-se a