Class AzureRateLimitRetryHandler
- java.lang.Object
-
- org.jclouds.http.handlers.RateLimitRetryHandler
-
- org.jclouds.azurecompute.arm.handlers.AzureRateLimitRetryHandler
-
- All Implemented Interfaces:
HttpRetryHandler
@Beta @Singleton public class AzureRateLimitRetryHandler extends RateLimitRetryHandler
Handles 429 Too Many Requests responses.The Azure ARM provider also returns this 429 HTTP status code for some errors when resources are busy or in a state where they cannot be modified. In this case this handler delegates to the
AzureRetryableErrorHandler
to determine if the requests can be retried.
-
-
Field Summary
-
Fields inherited from class org.jclouds.http.handlers.RateLimitRetryHandler
logger
-
Fields inherited from interface org.jclouds.http.HttpRetryHandler
ALWAYS_RETRY, NEVER_RETRY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
delayRequestUntilAllowed(HttpCommand command, HttpResponse response)
static boolean
isRateLimitError(HttpResponse response)
protected com.google.common.base.Optional<Long>
millisToNextAvailableRequest(HttpCommand command, HttpResponse response)
Compute the number of milliseconds that must pass until a request can be performed.-
Methods inherited from class org.jclouds.http.handlers.RateLimitRetryHandler
getMaxRateLimitWait, getRetryCountLimit, rateLimitErrorStatus, shouldRetryRequest
-
-
-
-
Method Detail
-
delayRequestUntilAllowed
protected boolean delayRequestUntilAllowed(HttpCommand command, HttpResponse response)
- Overrides:
delayRequestUntilAllowed
in classRateLimitRetryHandler
-
millisToNextAvailableRequest
protected com.google.common.base.Optional<Long> millisToNextAvailableRequest(HttpCommand command, HttpResponse response)
Description copied from class:RateLimitRetryHandler
Compute the number of milliseconds that must pass until a request can be performed.- Specified by:
millisToNextAvailableRequest
in classRateLimitRetryHandler
- Parameters:
command
- The command being executed.response
- The rate-limit error response.- Returns:
- The number of milliseconds to wait for an available request, if taht information is available.
-
isRateLimitError
public static boolean isRateLimitError(HttpResponse response)
-
-