Class SimpleRetryHandler

java.lang.Object
io.avaje.http.client.SimpleRetryHandler
All Implemented Interfaces:
RetryHandler

public class SimpleRetryHandler extends Object implements RetryHandler
Simple retry with max attempts and linear backoff.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SimpleRetryHandler(int maxRetries, int backoffMillis)
    Create with maximum number of retries and linear backoff time and no gitter.
    SimpleRetryHandler(int maxRetries, int backoffMillis, int gitterMillis)
    Create with maximum number of retries and linear backoff time.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isRetry(int retryCount, HttpResponse<?> response)
    Return true if the request should be retried.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SimpleRetryHandler

      public SimpleRetryHandler(int maxRetries, int backoffMillis, int gitterMillis)
      Create with maximum number of retries and linear backoff time.
      Parameters:
      maxRetries - The maximum number of retry attempts
      backoffMillis - The linear backoff between attempts in milliseconds
      gitterMillis - The maximum amount of gitter that gets added to backoffMillis
    • SimpleRetryHandler

      public SimpleRetryHandler(int maxRetries, int backoffMillis)
      Create with maximum number of retries and linear backoff time and no gitter.
      Parameters:
      maxRetries - The maximum number of retry attempts
      backoffMillis - The linear backoff between attempts in milliseconds
  • Method Details

    • isRetry

      public boolean isRetry(int retryCount, HttpResponse<?> response)
      Description copied from interface: RetryHandler
      Return true if the request should be retried.
      Specified by:
      isRetry in interface RetryHandler
      Parameters:
      retryCount - The number of retry attempts already executed
      response - The HTTP response
      Returns:
      True if the request should be retried or false if not