Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 82575 invoked from network); 24 Feb 2005 01:41:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 24 Feb 2005 01:41:37 -0000 Received: (qmail 80431 invoked by uid 500); 24 Feb 2005 01:41:34 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 80406 invoked by uid 500); 24 Feb 2005 01:41:34 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 80391 invoked by uid 99); 24 Feb 2005 01:41:34 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of dylans@gmail.com designates 64.233.170.207 as permitted sender) Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.207) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 23 Feb 2005 17:41:32 -0800 Received: by rproxy.gmail.com with SMTP id b11so189987rne for ; Wed, 23 Feb 2005 17:40:58 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=ol+xf6j0LSeXge8Pphdc73pxi0YsPm2I10QPxSCNxp7tIlwqDm6lqIkEcz+yqwR3cGsn077a/23tY+UjqOXtWTZ6AUlj0i6a+oUveb5MNSnB+pDVx7FCJvYtKkl5Mn+nRTMZq00xl2IaZ2qPS7j6dE9VTJDvG/OvEDOVRy1Gj3o= Received: by 10.38.72.54 with SMTP id u54mr97303rna; Wed, 23 Feb 2005 12:54:33 -0800 (PST) Received: by 10.38.24.70 with HTTP; Wed, 23 Feb 2005 12:54:33 -0800 (PST) Message-ID: <292e734005022312542dd6a9b@mail.gmail.com> Date: Wed, 23 Feb 2005 12:54:33 -0800 From: Dylan Stamat Reply-To: Dylan Stamat To: Jakarta Commons Users List Subject: Re: Commons HttpClient: HttpClient#setConnectionTimeout In-Reply-To: <421CE076.7010307@noaa.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <421CE076.7010307@noaa.gov> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hello John ! 5000 millis is 83 seconds... correct ? I think you want to use 300 as the value instead. My math or conversion may be way off, but I think this is it :) Let me know ! == Dylan On Wed, 23 Feb 2005 12:58:46 -0700, John C Cartwright wrote: > Hello All, > > I'm attempting to throw an exception when the connection cannot be > established within 5 seconds (see code excerpt below). However when the > target host is down (doesn't respond to ping), it takes much longer than > 5 seconds before the exception is actually thrown. > > Can someone point out what I'm doing wrong? > > Thanks! > > -- john > > HttpClient client = new HttpClient(); > HttpMethod method = new GetMethod(url); > client.setConnectionTimeout(5000); //wait 5 seconds for response > try { > statusCode = client.executeMethod(method); > String responseBody = method.getResponseBodyAsString(); > } catch (Exception e){ > log.fatal("error reading URL",e); > throw new IllegalStateException ("Error reading URL"); > } finally { > method.releaseConnection(); > } > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org