fix:禁用httpclient底层retry策略;

master
xueli.xue 9 years ago
parent 70783426b3
commit d905e4fa68
  1. 4
      xxl-job-core/src/main/java/com/xxl/job/core/util/HttpUtil.java

@ -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) {

Loading…
Cancel
Save