Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 33501 invoked from network); 25 Mar 2008 20:14:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Mar 2008 20:14:42 -0000 Received: (qmail 78405 invoked by uid 500); 25 Mar 2008 20:14:40 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 78389 invoked by uid 500); 25 Mar 2008 20:14:40 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 78380 invoked by uid 99); 25 Mar 2008 20:14:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2008 13:14:40 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [217.150.250.44] (HELO ok2consulting.nine.ch) (217.150.250.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2008 20:13:57 +0000 Received: by ok2consulting.nine.ch (Postfix, from userid 1002) id 5BE6A198422; Tue, 25 Mar 2008 21:14:07 +0100 (CET) Received: from [192.168.1.102] (84-75-108-49.dclient.hispeed.ch [84.75.108.49]) by ok2consulting.nine.ch (Postfix) with ESMTP id 13D7E198420 for ; Tue, 25 Mar 2008 21:14:07 +0100 (CET) Subject: Re: httpclient3 takes 3 minutes to catch IOException, why so long? From: Oleg Kalnichevski To: HttpClient User Discussion In-Reply-To: <555575.37700.qm@web57204.mail.re3.yahoo.com> References: <555575.37700.qm@web57204.mail.re3.yahoo.com> Content-Type: text/plain Date: Tue, 25 Mar 2008 21:14:07 +0100 Message-Id: <1206476047.5731.24.camel@ubuntu> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on ok2consulting.nine.ch X-Spam-Level: X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham version=3.0.3 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