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: Is it good practice to set the connection timeout for ThreadSafeClientConnManager implementation?
Date Mon, 04 Jul 2011 15:48:36 GMT
On Mon, 2011-07-04 at 02:17 -0700, bnijjhar wrote:
> Hi
> I've set the socket timeout for my DefaultHttpClient 4.1.1. However, I'm
> unsure whether to set the connection timeout.

You should.

>  It seems that for an
> HttpClient using the ThreadSafeClientConnManager, the threads are
> effectively waiting for a connection from the connection manager's pool
> (rather than whether the connection has been established). So if the
> connection manager does not manage to establish the connection within the
> connection timeout (e.g. 100 ms) for the first thread, then the second
> thread which might have been waiting from about the same time as the first
> thread, receives a timeout almost immediately (instead of the connection
> manager trying again and giving a timeout 100 ms later). 

The connect timeout for all threads would be the same (100 ms)
regardless of how long it took to lease the connection from the pool.

Hope this helps


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

View raw message