hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject RE: Confused about guidelines for using HttpClient instance in multiple threads
Date Tue, 17 May 2011 10:48:56 GMT
On Mon, 2011-05-16 at 21:10 +0000, KARR, DAVID (ATTSI) wrote:
> > -----Original Message-----
> > From: Moore, Jonathan (CIM) [mailto:Jonathan_Moore@Comcast.com]
> > Sent: Monday, May 16, 2011 1:15 PM
> > To: HttpClient User Discussion
> > Subject: Re: Confused about guidelines for using HttpClient instance in
> > multiple threads
> > 
> > All this is trying to say is that you don't need a new
> > DefaultHttpClient
> > instance for every thread, particularly if you only have one connection
> > pool. Multiple threads can use the same DefaultHttpClient to execute
> > HTTP
> > requests.
> > 
> > However, when the singleton instance passes out of scope, a clean
> > shutdown
> > requires also shutting down the ConnectionManager.
> > 
> > Does that help?
> 
> Then what's the difference between using the default client connection manager, as opposed
to the ThreadSafeClientConnManager?
> 

Both are thread-safe but the default can have only one connection at a
time, so requests can be executed sequentially, one by one, whereas
ThreadSafeClientConnManager can execute multiple requests over multiple
connections concurrently.

ThreadSafeClientConnManager was unfortunately a very bad choice of name
for the class. 

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message