On Mon, 2013-11-04 at 20:35 +0100, Christopher BROWN wrote:
> Hello,
> 
> I'm upgrading HTTP Client from 4.2 to 4.3.1, and one issue I'm encountering
> is that I can't seem to find how to change some properties at runtime, like
> this:
> 
> final ClientConnectionManager cm = _http.getConnectionManager();
> if (cm instanceof PoolingHttpClientConnectionManager)
> {
>   cm.setDefaultMaxPerRoute(networkPoolSize);
> cm.setMaxTotal(networkPoolSize);
> }
> 
> Would I be correct in assuming that I have to drop my instance of
> CloseableHttpClient (shutdown and so on, hopefully without disrupting
> service) and replace it with a new instance?
> 
> --
> Christopher

Christopher

Discarding perfectly valid CloseableHttpClient should not be necessary.
Why do not you simply keep a reference to the connection manager in
order to apply different connection limits?

---
PoolingHttpClientConnectionManager connman = new
PoolingHttpClientConnectionManager();
CloseableHttpClient client = HttpClients.custom()
 .setConnectionManager(connman).build();
connman.setMaxTotal(networkPoolSize);
---

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to