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: httpclient3 takes 3 minutes to catch IOException, why so long?
Date Tue, 25 Mar 2008 20:14:07 GMT

On Mon, 2008-03-24 at 16:44 -0700, ever friend wrote:
> Greeting...
>    
>   I use httpclient3 to communicate with a web server application.
>   
> when I test an error handling, it takes 3 minutes to catch the IOException (I manually
unplug the internet connection). I assumed it takes couple ms to catch IOException since only
one line of code/function-call there (client.executeMethod(method) to cause the IOException,
but it takes 3 minutes. It seems sth. inside executeMethod is doing sth.........
>   
> Could some experters provide an inside about why it taks so long, and how to make it
quicker to catch the exception?
>   
> (note: I have set the retryhandler to 0 retry. I just want to find the IO problem asap.)
>    
>   the code is sth. like:
> .....
> HttpClient client = new HttpClient();
> PostMethod method = new PostMethod("http://www.x.com");
>             
>             NameValuePair[] data = {
>               
>             };
>             method.setRequestBody(data);
>               
>             // do not want to retry, so set to 0.
>             method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, 
>               new DefaultHttpMethodRetryHandler(0, false));
>    
>               try {
>               // Execute the method.
>               int statusCode = client.executeMethod(method);
>                 if (statusCode != HttpStatus.SC_OK) {
>                  ....
>               }else{
>                 ...
>               }
>             } catch (HttpException e) {
>                 ...
>               
>             } catch (IOException e) {
>               ...
>             } finally {
>               // Release the connection.
>               method.releaseConnection();
>             } 
>    
>   Thank you,
>   Ever
> 

HttpClient simply propagates I/O exceptions thrown by the socket
input/output streams. This looks like a JRE/OS issue to me.

Oleg 


>        
> ---------------------------------
> Never miss a thing.   Make Yahoo your homepage.


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