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
public static InetAddress getByName(String host)
throws UnknownHostException {
return InetAddress.getAllByName(host)[0];
}
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]