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
---------------------------------
Never miss a thing. Make Yahoo your homepage.