提交 d905e4fa 编写于 作者: X xueli.xue

fix:禁用httpclient底层retry策略;

上级 70783426
......@@ -67,7 +67,6 @@ public class HttpUtil {
CloseableHttpClient httpClient = null;
try{
httpPost = new HttpPost(reqURL);
httpClient = HttpClients.createDefault();
if (params != null && !params.isEmpty()) {
List<NameValuePair> formParams = new ArrayList<NameValuePair>();
for(Map.Entry<String,String> entry : params.entrySet()){
......@@ -78,6 +77,9 @@ public class HttpUtil {
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(5000).setConnectTimeout(5000).build();
httpPost.setConfig(requestConfig);
//httpClient = HttpClients.createDefault(); // default retry 3 times
httpClient = HttpClients.custom().disableAutomaticRetries().build();
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
if (response.getStatusLine().getStatusCode() == 200) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册