Browse Source

httpclient防止重复提交

xuxueli 8 years ago
parent
commit
667d486899

+ 4 - 2
xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java View File

30
 		byte[] responseBytes = null;
30
 		byte[] responseBytes = null;
31
 		
31
 		
32
 		HttpPost httpPost = new HttpPost(reqURL);
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
 		try {
36
 		try {
35
 			// init post
37
 			// init post
36
 			/*if (params != null && !params.isEmpty()) {
38
 			/*if (params != null && !params.isEmpty()) {
62
 				EntityUtils.consume(entity);
64
 				EntityUtils.consume(entity);
63
 			}
65
 			}
64
 		} catch (Exception e) {
66
 		} catch (Exception e) {
65
-			logger.error(e.getMessage(), e);
67
+			logger.error("", e);
66
 			throw e;
68
 			throw e;
67
 		} finally {
69
 		} finally {
68
 			httpPost.releaseConnection();
70
 			httpPost.releaseConnection();