diff --git a/luqj-common/src/main/java/com/luqj/util/HttpHelper.java b/luqj-common/src/main/java/com/luqj/util/HttpHelper.java index ea514e5..1609320 100644 --- a/luqj-common/src/main/java/com/luqj/util/HttpHelper.java +++ b/luqj-common/src/main/java/com/luqj/util/HttpHelper.java @@ -59,7 +59,7 @@ public class HttpHelper { public void setProxyPort(Integer proxyPort) { this.proxyPort = proxyPort; } - public void closeClient(){ + public synchronized void closeClient(){ try { if (httpsClient != null) { httpsClient.close(); @@ -72,6 +72,12 @@ public class HttpHelper { }catch (Exception e){ log.error(e.getMessage(),e); } + if (cm != null) { + cm.close(); + } + cm = new PoolingHttpClientConnectionManager(); + cm.setMaxTotal(500); + cm.setDefaultMaxPerRoute(5); } public static void main(String[] args) throws Exception { BigDecimal decimal = new BigDecimal("1").divide(new BigDecimal(100));