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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]