From d905e4fa682898cc34bfdeb3351e4256a1b3fdf7 Mon Sep 17 00:00:00 2001 From: "xueli.xue" Date: Thu, 30 Jun 2016 13:26:32 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E7=A6=81=E7=94=A8httpclient?= =?UTF-8?q?=E5=BA=95=E5=B1=82retry=E7=AD=96=E7=95=A5=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/xxl/job/core/util/HttpUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpUtil.java index a4d123f0..64508e7d 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpUtil.java +++ b/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 formParams = new ArrayList(); for(Map.Entry 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) {