配置中增加关闭连接response.close()

This commit is contained in:
zhanghongqing
2018-11-21 15:14:28 +08:00
parent f5e3b17761
commit 1f0aafb4bf
3 changed files with 94 additions and 3 deletions

View File

@@ -247,7 +247,7 @@ public class HttpClientUtil {
* @param params 参数列表
* @return 查询结果数据json
*/
public static String getMsg(String destUrl, Map<String, Object> params, HttpServletRequest req) {
public static String getMsg(String destUrl, Map<String, Object> params, HttpServletRequest req) throws IOException {
// RequestContext requestContext = new RequestContext(req);
// CloseableHttpResponse response = null;
@@ -296,7 +296,11 @@ public class HttpClientUtil {
logger.error("获取消息失败,相应内容如下: " + result);
logger.error("获取消息失败 ", e);
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:");
}
}finally {
if (response != null) {
response.close();
}
}
return result;
}