Explorar o código

fix:禁用httpclient底层retry策略;

xueli.xue %!s(int64=8) %!d(string=hai) anos
pai
achega
d905e4fa68

+ 3 - 1
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) {