Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 65698 invoked from network); 22 Oct 2010 13:25:13 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Oct 2010 13:25:13 -0000 Received: (qmail 40493 invoked by uid 500); 22 Oct 2010 13:25:13 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 40106 invoked by uid 500); 22 Oct 2010 13:25:10 -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 40094 invoked by uid 99); 22 Oct 2010 13:25:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Oct 2010 13:25:10 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of greg.lindholm@gmail.com designates 74.125.82.179 as permitted sender) Received: from [74.125.82.179] (HELO mail-wy0-f179.google.com) (74.125.82.179) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Oct 2010 13:25:03 +0000 Received: by wye20 with SMTP id 20so933238wye.10 for ; Fri, 22 Oct 2010 06:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=VKVMISRz+kP59esczu9CFP/4bG5y0eH/8/uIEQV9s68=; b=lKsZYMKPCunjTSygTZl1aXWsSUC5QS1JbiNVvY9dUuGkxzCSIty627yJDLJ5f7bOn8 d66eIOzqubWXtnIBo9WE7yshb7RIqU1wa83JYqYVmgZefvFYXjl7pjo2X9tsvA4osJNr RA9MRVJofeEDbxubLbzSoqQgQ2lciKHYviAY0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=XfCVO9Cv9prGHdgpPxfNQv537mQenub3QRfIUx/niKUrpYfTmEmO8J8Dsvufr7iWdC naV/vsZXVVMn9cxoWPJiwG04RsyhW8/tlReqxEOULeMTp2cKSyZzicObpWs5g1y/bsmh JGPnDkd+zUCTTh4PkdkGrGZ/1HVWLc7Byt6aI= MIME-Version: 1.0 Received: by 10.227.143.75 with SMTP id t11mr2689892wbu.190.1287753880631; Fri, 22 Oct 2010 06:24:40 -0700 (PDT) Received: by 10.216.6.130 with HTTP; Fri, 22 Oct 2010 06:24:40 -0700 (PDT) In-Reply-To: <1287696676.2322.36.camel@ubuntu> References: <1287696676.2322.36.camel@ubuntu> Date: Fri, 22 Oct 2010 09:24:40 -0400 Message-ID: Subject: Re: Retry with multiple IP addresses From: Greg Lindholm To: HttpClient User Discussion Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks, that's great. Perfect excuse to upgrade. On Thu, Oct 21, 2010 at 5:31 PM, Oleg Kalnichevski wrote= : > On Thu, 2010-10-21 at 17:04 -0400, Greg Lindholm wrote: >> A service we use has suggested to us that if a HTTP request to them >> fails (for whatever reason) that we should retry the request using one >> of the other IP addresses that DNS returns. >> >> I traced through HttpClient 3.0 (I haven't upgraded yet) and see how >> the Socket Factory is using the standard Socket() constructor with the >> host name which internally uses InetAddress.getByName(hostname) which >> internally does a >> >> =A0 =A0 public static InetAddress getByName(String host) >> =A0 =A0 =A0 throws UnknownHostException { >> =A0 =A0 =A0 return InetAddress.getAllByName(host)[0]; >> =A0 =A0 } >> >> So it will retrieve all the IP addresses for the host and then always >> use the first one. >> >> Question 1) Does the new HttpClient have any facility to retry a >> failed request on the next IP address? >> >> if Q1 is NO then: >> >> Question 2) How would I go about providing this facility? Can I >> provide a custom Socket Factory? Any suggestions? (I am not an expert >> on HttpClient so please provide enough details for a newbie to follow >> along.) >> >> I can figure out how to construct a Socket using a InetAdrress >> (instead of a hostname) and deal with round-robin thru the IP >> addresses. The thing I need help on is how to hook this into >> HttpClient. >> >> Thanks >> >> Greg >> > > Greg > > Versions 4.0.3 and 4.1-alpha2 provide support for multihome hosts out of > the box. HttpClient uses a simple round-robin algorithm per default, but > one can implement a more complex logic with the new API available in > HttpClient 4.1 > > Hope this helps > > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > For additional commands, e-mail: httpclient-users-help@hc.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org