Class HttpTransporter.ResolverServiceUnavailableRetryStrategy

  • All Implemented Interfaces:
    org.apache.http.client.ServiceUnavailableRetryStrategy
    Enclosing class:
    HttpTransporter

    private static class HttpTransporter.ResolverServiceUnavailableRetryStrategy
    extends java.lang.Object
    implements org.apache.http.client.ServiceUnavailableRetryStrategy
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ResolverServiceUnavailableRetryStrategy​(int retryCount, long retryInterval, long retryIntervalMax, java.util.Set<java.lang.Integer> serviceUnavailableHttpCodes)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getRetryInterval()  
      private java.lang.Long retryInterval​(org.apache.http.HttpResponse httpResponse, int executionCount, org.apache.http.protocol.HttpContext httpContext)
      Calculates retry interval in milliseconds.
      boolean retryRequest​(org.apache.http.HttpResponse response, int executionCount, org.apache.http.protocol.HttpContext context)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • retryCount

        private final int retryCount
      • retryInterval

        private final long retryInterval
      • retryIntervalMax

        private final long retryIntervalMax
      • serviceUnavailableHttpCodes

        private final java.util.Set<java.lang.Integer> serviceUnavailableHttpCodes
      • RETRY_INTERVAL_HOLDER

        private static final java.lang.ThreadLocal<java.lang.Long> RETRY_INTERVAL_HOLDER
        Ugly, but forced by HttpClient API ServiceUnavailableRetryStrategy: the calls for retryRequest(HttpResponse, int, HttpContext) and getRetryInterval() are done by same thread and are actually done from spot that are very close to each other (almost subsequent calls).
    • Constructor Detail

      • ResolverServiceUnavailableRetryStrategy

        private ResolverServiceUnavailableRetryStrategy​(int retryCount,
                                                        long retryInterval,
                                                        long retryIntervalMax,
                                                        java.util.Set<java.lang.Integer> serviceUnavailableHttpCodes)
    • Method Detail

      • retryRequest

        public boolean retryRequest​(org.apache.http.HttpResponse response,
                                    int executionCount,
                                    org.apache.http.protocol.HttpContext context)
        Specified by:
        retryRequest in interface org.apache.http.client.ServiceUnavailableRetryStrategy
      • retryInterval

        private java.lang.Long retryInterval​(org.apache.http.HttpResponse httpResponse,
                                             int executionCount,
                                             org.apache.http.protocol.HttpContext httpContext)
        Calculates retry interval in milliseconds. If HttpHeaders.RETRY_AFTER header present, it obeys it. Otherwise, it returns {@link this#retryInterval} long value multiplied with executionCount (starts from 1 and goes 2, 3,...).
        Returns:
        Long representing the retry interval as millis, or null if the request should be failed.
      • getRetryInterval

        public long getRetryInterval()
        Specified by:
        getRetryInterval in interface org.apache.http.client.ServiceUnavailableRetryStrategy