PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager();
connManager.setMaxTotal(120);
connManager.setDefaultMaxPerRoute(20);
CloseableHttpClient httpClient = HttpClientBuilder.create()
.setConnectionManager(connManager)
.build();
关闭httpClient就足够了吗?还是我还必须显式关闭连接管理器?
httpClient.close(); // Is this enough?
同时找到了答案。AbstractHttpClient似乎关闭了连接管理器。所以我认为关闭httpclient应该没问题。
请参阅org. apache.http.implp.client.AbstractHttpClient
@Override
public void close() {
getConnectionManager().shutdown();
}