Class RateLimitRetryHandler

    • Field Detail

      • logger

        protected Logger logger
    • Constructor Detail

      • RateLimitRetryHandler

        public RateLimitRetryHandler()
    • Method Detail

      • rateLimitErrorStatus

        protected int rateLimitErrorStatus()
        Returns the response status that will be considered a rate limit error.

        Providers can override this to customize which responses are retried.

      • millisToNextAvailableRequest

        protected abstract 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.
        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.
      • shouldRetryRequest

        public boolean shouldRetryRequest​(HttpCommand command,
                                          HttpResponse response)
        Description copied from interface: HttpRetryHandler
        Return true if the command should be retried. This method should only be invoked when the response has failed with a HTTP 5xx error indicating a server-side error.
        Specified by:
        shouldRetryRequest in interface HttpRetryHandler
      • delayRequestUntilAllowed

        protected boolean delayRequestUntilAllowed​(HttpCommand command,
                                                   HttpResponse response)
      • getRetryCountLimit

        public int getRetryCountLimit()
      • getMaxRateLimitWait

        public int getMaxRateLimitWait()