Package com.auth0.net
Class RateLimitInterceptor
java.lang.Object
com.auth0.net.RateLimitInterceptor
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionRateLimitInterceptor(int maxRetries) Constructs a new instance with the maximum number of allowed retries. -
Method Summary
Modifier and TypeMethodDescriptionintokhttp3.Responseintercept(okhttp3.Interceptor.Chain chain)
-
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:
interceptin interfaceokhttp3.Interceptor- Throws:
IOException
-