提交 667d4868 authored 作者: xuxueli's avatar xuxueli

httpclient防止重复提交

上级 837ab404
...@@ -30,7 +30,9 @@ public class HttpClientUtil { ...@@ -30,7 +30,9 @@ public class HttpClientUtil {
byte[] responseBytes = null; byte[] responseBytes = null;
HttpPost httpPost = new HttpPost(reqURL); HttpPost httpPost = new HttpPost(reqURL);
CloseableHttpClient httpClient = HttpClients.createDefault(); //CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpClient httpClient = HttpClients.custom().disableAutomaticRetries().build(); // disable retry
try { try {
// init post // init post
/*if (params != null && !params.isEmpty()) { /*if (params != null && !params.isEmpty()) {
...@@ -62,7 +64,7 @@ public class HttpClientUtil { ...@@ -62,7 +64,7 @@ public class HttpClientUtil {
EntityUtils.consume(entity); EntityUtils.consume(entity);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error("", e);
throw e; throw e;
} finally { } finally {
httpPost.releaseConnection(); httpPost.releaseConnection();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论