我正在使用单例的
我期望
DefaultHttpClient
,每秒进行大约十几个并行的HTTP请求。我想知道如何以聪明的方式设置下面代码中 'PoolingClientConnectionManager' 的值 x(最大总连接数) 和 y(默认每个路由的最大连接数)。我期望
PoolingClientConnectionManager
能够帮助我,以便在负载峰值或负载远低于平常时不必更改这些值。我该怎么做?还是必须将这些值设置为始终比实际需要的值更大的值?...
PoolingClientConnectionManager poolingClientConnectionManager =
new PoolingClientConnectionManager(sr, 20, TimeUnit.SECONDS);
poolingClientConnectionManager.setMaxTotal(x);
poolingClientConnectionManager.setDefaultMaxPerRoute(y);
return new DefaultHttpClient(poolingClientConnectionManager, new BasicHttpParams());
编辑:说poolingClientConnectionManager.setMaxTotal(Integer.MAX_VALUE)
是一个好主意吗?