소스 검색

httpclient防止重复提交

xuxueli 8 년 전
부모
커밋
667d486899
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java

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

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