You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Gordon Ross <gr...@ucs.cam.ac.uk> on 2012/05/17 15:02:10 UTC

HttpClient 4.1 & Threading

Using HttpClient 4.1, I'm creating an instance by:

client = DefaultHttpClient(new ThreadSafeClientConnManager());

Which gives me a thread-safe environment. But how separate are the thread environments ?

If I set headers, cookies, etc. are these shared between all threads ? Or does ThreadSafeClientConnManager keep these all separate ?

Thanks,

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


Re: HttpClient 4.1 & Threading

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2012-05-17 at 13:02 +0000, Gordon Ross wrote:
> Using HttpClient 4.1, I'm creating an instance by:
> 
> client = DefaultHttpClient(new ThreadSafeClientConnManager());
> 
> Which gives me a thread-safe environment. But how separate are the thread environments ?
> 
> If I set headers, cookies, etc. are these shared between all threads ? Or does ThreadSafeClientConnManager keep these all separate ?
> 
> Thanks,
> 
> GTG

Objects such as CookieStore set at the HttpClient level will be shared
by the threads that use that client to execute requests. Objects set in
a local HttpContext will be used within that context only.  

Hope this helps

Oleg



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