hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gajo Csaba <csaba.g...@cosylab.com>
Subject Re: How to manage timeouts?
Date Thu, 18 Mar 2010 08:19:59 GMT
On 03/17/2010 10:04 PM, Oleg Kalnichevski wrote:
> Gajo Csaba wrote:
>> OK I've found a solution which works. I'm not sure if this is the 
>> best, but so far it works.
>>
>> I wrote a custom class which extends BufferingHttpClientHandler, and 
>> overrode its timeout() method.
>>
>> public void timeout(final NHttpClientConnection conn) {
>>      HttpContext context = conn.getContext();
>>      conn.setSocketTimeout(5000);
>>      conn.requestOutput();
>> }
>>
>> I basically took the source code from AsyncNHttpClientHandler and 
>> removed the bits that referred to the internal ClientConnState class...
>>
>> Regards, Csaba
>>
>
> Please note, though, that in this case you simply reset the connection 
> timeout and the connection effectively never times out. This begs the 
> question why you need to set timeout at all
>
> Oleg

I think by default all sockets have some default timeout, no?

Csaba



---------------------------------------------------------------------
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