Kaynağa Gözat

httpclient防止重复提交

xuxueli 8 yıl önce
ebeveyn
işleme
667d486899

+ 4 - 2
xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java Dosyayı Görüntüle

@@ -30,7 +30,9 @@ public class HttpClientUtil {
30 30
 		byte[] responseBytes = null;
31 31
 		
32 32
 		HttpPost httpPost = new HttpPost(reqURL);
33
-		CloseableHttpClient httpClient = HttpClients.createDefault();
33
+		//CloseableHttpClient httpClient = HttpClients.createDefault();
34
+		CloseableHttpClient httpClient = HttpClients.custom().disableAutomaticRetries().build();	// disable retry
35
+
34 36
 		try {
35 37
 			// init post
36 38
 			/*if (params != null && !params.isEmpty()) {
@@ -62,7 +64,7 @@ public class HttpClientUtil {
62 64
 				EntityUtils.consume(entity);
63 65
 			}
64 66
 		} catch (Exception e) {
65
-			logger.error(e.getMessage(), e);
67
+			logger.error("", e);
66 68
 			throw e;
67 69
 		} finally {
68 70
 			httpPost.releaseConnection();