|
|
@ -51,14 +51,15 @@ public class HttpsUtils { |
|
|
|
|
|
|
|
|
|
|
|
private static PoolingHttpClientConnectionManager connMgr; |
|
|
|
private static PoolingHttpClientConnectionManager connMgr; |
|
|
|
private static RequestConfig requestConfig; |
|
|
|
private static RequestConfig requestConfig; |
|
|
|
private static final int MAX_TIMEOUT = 15000; |
|
|
|
private static final int MAX_TIMEOUT = 10000; |
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
static { |
|
|
|
// 设置连接池
|
|
|
|
// 设置连接池
|
|
|
|
connMgr = new PoolingHttpClientConnectionManager(); |
|
|
|
connMgr = new PoolingHttpClientConnectionManager(); |
|
|
|
// 设置连接池大小
|
|
|
|
// 设置连接池大小
|
|
|
|
connMgr.setMaxTotal(100); |
|
|
|
connMgr.setMaxTotal(1000); |
|
|
|
connMgr.setDefaultMaxPerRoute(connMgr.getMaxTotal()); |
|
|
|
// 并发数量
|
|
|
|
|
|
|
|
connMgr.setDefaultMaxPerRoute(500); |
|
|
|
// Validate connections after 1 sec of inactivity
|
|
|
|
// Validate connections after 1 sec of inactivity
|
|
|
|
connMgr.setValidateAfterInactivity(1000); |
|
|
|
connMgr.setValidateAfterInactivity(1000); |
|
|
|
RequestConfig.Builder configBuilder = RequestConfig.custom(); |
|
|
|
RequestConfig.Builder configBuilder = RequestConfig.custom(); |
|
|
|