Package com.auth0.net

Class RateLimitInterceptor

java.lang.Object
com.auth0.net.RateLimitInterceptor
All Implemented Interfaces:
okhttp3.Interceptor

public class RateLimitInterceptor extends Object implements okhttp3.Interceptor
An OkHttp Interceptor responsible for retrying rate-limit errors (429) using a configurable maximum number of retries, and an exponential backoff on retry attempts.

Note: This class is not intended for general use or extension, and may change at any time.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface okhttp3.Interceptor

    okhttp3.Interceptor.Chain, okhttp3.Interceptor.Companion
  • Field Summary

    Fields inherited from interface okhttp3.Interceptor

    Companion
  • Constructor Summary

    Constructors
    Constructor
    Description
    RateLimitInterceptor(int maxRetries)
    Constructs a new instance with the maximum number of allowed retries.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    okhttp3.Response
    intercept(okhttp3.Interceptor.Chain chain)
     

    Methods inherited from class java.lang.Object

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

    • RateLimitInterceptor

      public RateLimitInterceptor(int maxRetries)
      Constructs a new instance with the maximum number of allowed retries.
      Parameters:
      maxRetries - the maximum number of consecutive retries to attempt.
  • Method Details

    • getMaxRetries

      public int getMaxRetries()
      Returns:
      the configured number of maximum retries.
    • intercept

      @NotNull public okhttp3.Response intercept(@NotNull okhttp3.Interceptor.Chain chain) throws IOException
      Specified by:
      intercept in interface okhttp3.Interceptor
      Throws:
      IOException