Reputation: 19606
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager();
connManager.setMaxTotal(120);
connManager.setDefaultMaxPerRoute(20);
CloseableHttpClient httpClient = HttpClientBuilder.create()
.setConnectionManager(connManager)
.build();
Is it enough to close the httpClient or do I also have to explicitly close the connectionManager?
httpClient.close(); // Is this enough?
Upvotes: 1
Views: 495
Reputation: 19606
Found the answer in the mean time. AbstractHttpClient seems to shut down the connection manager. So I think it should be ok to just close the httpclient.
See org.apache.http.impl.client.AbstractHttpClient
@Override
public void close() {
getConnectionManager().shutdown();
}
Upvotes: 1