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 asolodin <as...@comcast.net> on 2010/10/20 01:04:06 UTC

Connection timeout per host?

Is there a way to specify a connection timeout that would be different for
each host (connection pool)? I am using Http Client 3.1 in a multithreaded
environment so a single client instance is shared among many threads
executing concurrent requests to different hosts. Thus I cannot specify the
connection timeout on the client or globally. There is a setter for
connection timeout on the HttpConnectionParams but I don't see a way to
specify a different value for each host.. What I need would be similar to
how max connections per host can be specified for each HostConfiguration via
a map. Maybe I am missing something?

Thanks
Andrei
-- 
View this message in context: http://old.nabble.com/Connection-timeout-per-host--tp30004821p30004821.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: Connection timeout per host?

Posted by Oleg Kalnichevski <ol...@apache.org>.
My bad. I thought you were referring to the socket timout setting. You will have to upgrade to HttpClient 4.0 to be able to set connect timout on the HTTP request level.

Oleg

"asolodin" <as...@comcast.net> wrote:

>
>
>olegk wrote:
>> 
>> Andrei,
>> 
>> Socket timeout can be set either on the HTTP agent or the HTTP
>request
>> level.
>> 
>> You can set a different socket timeout value on each HTTP request
>> depending on kind of a target host it is going to be executed
>against.
>> 
>> Hope this helps
>> 
>> Oleg
>> 
>
>Oleg, thank you for your reply. Just to make sure we are on the same
>page, I
>was talking about the http.connection.timeout property, which according
>to
>the documentation can be specified through: global -> client ->
>connection
>manager -> connection. I don't see a way to specify a connection
>timeout on
>the method, other than through a name/value. But then I don't see where
>in
>the code the connection would be using the value passed in the method.
>Regarding the SO_TIMEOUT, I do see how the value in method overrides
>the one
>in the connection, this is in HttpMethodDirector.applyConnectionParams.
>I am
>looking for similar logic for http.connection.timeout property.
>
>Thank you.
>
>-- 
>View this message in context:
>http://old.nabble.com/Connection-timeout-per-host--tp30004821p30011897.html
>Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>For additional commands, e-mail: httpclient-users-help@hc.apache.org


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


Re: Connection timeout per host?

Posted by asolodin <as...@comcast.net>.

olegk wrote:
> 
> Andrei,
> 
> Socket timeout can be set either on the HTTP agent or the HTTP request
> level.
> 
> You can set a different socket timeout value on each HTTP request
> depending on kind of a target host it is going to be executed against.
> 
> Hope this helps
> 
> Oleg
> 

Oleg, thank you for your reply. Just to make sure we are on the same page, I
was talking about the http.connection.timeout property, which according to
the documentation can be specified through: global -> client -> connection
manager -> connection. I don't see a way to specify a connection timeout on
the method, other than through a name/value. But then I don't see where in
the code the connection would be using the value passed in the method.
Regarding the SO_TIMEOUT, I do see how the value in method overrides the one
in the connection, this is in HttpMethodDirector.applyConnectionParams. I am
looking for similar logic for http.connection.timeout property.

Thank you.

-- 
View this message in context: http://old.nabble.com/Connection-timeout-per-host--tp30004821p30011897.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: Connection timeout per host?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2010-10-19 at 16:04 -0700, asolodin wrote:
> Is there a way to specify a connection timeout that would be different for
> each host (connection pool)? I am using Http Client 3.1 in a multithreaded
> environment so a single client instance is shared among many threads
> executing concurrent requests to different hosts. Thus I cannot specify the
> connection timeout on the client or globally. There is a setter for
> connection timeout on the HttpConnectionParams but I don't see a way to
> specify a different value for each host.. What I need would be similar to
> how max connections per host can be specified for each HostConfiguration via
> a map. Maybe I am missing something?
> 
> Thanks
> Andrei

Andrei,

Socket timeout can be set either on the HTTP agent or the HTTP request
level.

You can set a different socket timeout value on each HTTP request
depending on kind of a target host it is going to be executed against.

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