hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Wright <daddy...@gmail.com>
Subject Under what conditions would you prefer org.apache.http.impl.client.HttpClientBuilder#setMaxConnTotal to org.apache.http.impl.conn.PoolingHttpClientConnectionManager#setMaxTotal?
Date Fri, 04 Apr 2014 13:03:57 GMT
Hi Oleg,

We use a certain pattern a lot, which is the following:

- we have a pool of objects, which MCF manages, which needs HttpClient
instances to communicate with external systems
- we want the HttpClient instances to be reused, where possible, but it
only makes sense to reuse HttpClient instances within the context of one of
MCF's objects
- Each MCF object only directly uses one HttpClient object at a time

In the past, we did this by creating an HttpConnectionPool per MCF object,
and limiting it to size 1.  We would create HttpClient objects using the
"new HttpClient(HttpConnectionPool)" constructor, or the equivalent.

In the 4.3 world, our committers have tried to model this in two different

(a) Creating a PoolingHttpClientConnectionManager object, and calling
setMaxTotal(1) on it, and setting the connection manager when building the
HttpClient object, or
(b) Creating a PoolingHttpClientConnectionManager object, setting the
connection manager when building the HttpClient object, and using
setMaxConnTotal(1) in the builder

Which does the right thing?  Would either of these work equally well, or do
none of them work in the way intended?

Thanks in advance,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message