java: apache HttpClient > how to disable retry

前端 未结 5 2045
再見小時候
再見小時候 2021-02-01 16:41

I\'m using Apache Httpclient for Ajax-calls on a website. In some cases requests to external webservice fail, often with:

I/O exception (java.net.ConnectException) caug

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-01 17:18

    The cast to AbstractHttpClient is not necessary. Another way is to use a strategy with AutoRetryHttpClient with DefaultServiceUnavailableRetryStrategy set to 0 for retry parameter. A better way would be to extend the AbstractHttpClient or implement HttpClient to expose the desired method.

提交回复
热议问题