Hi, On Fri, Aug 21, 2015 at 1:23 AM, John Gardiner Myers <[email protected]> wrote: > I am looking into in contributing a change to add support for multi-homed > destinations to Jetty HttpClient. This would seem to involve replacing > SocketAddressResolver with something that uses > InetAddress.getAllByName(String). > > I was thinking of an implementation that tries each address in order (giving > each one a full connectTimeout) until one connection succeeds. > > This appears to require making incompatible changes to the public API. For > one, HttpClient exposes a getter and setter for its SocketAddressResolver.
This change has been made only very recently, and it's not out to a release yet. So we can change SocketAddressResolver.resolve(...) to take a Promise<List<SocketAddress>>. > For another, implementations of HttpClientTransport could assume that there > would be only one attempt to call HttpClientTransport.connect(SocketAddress, > Map<String, Object>) per destination. For example, > HttpClientTransportOverHTTP2 aborts the HttpDestination on a connection > failure. No, the connect() operation only notifies a callback. If HttpClient.newConnection() is changed to call transport.connect() passing in a local callback that detects whether the connection has been successful or not, then we should be able to implement what you want. If the local callback fails, just go to the next SocketAddress. > Happy Eyeballs would break even more assumptions made by HttpClientTransport > implementations. I don't think any assumption will be broken. The transport is asked to connect and it is given a callback to notify that. What the callback does after the connect is entirely replaceable. > There's also the minor issue that it isn't possible to get a collection of > InetSocketAddress for a multi-homed hostname where each InetSocketAddress > knows its hostname. This I don't follow. Can you expand ? Just to recap your requisite: You configure your DNS with multiple IPs for a single host name. You would like to resolve the host name using getAllByName(String), and try to connect to the IPs until the first succeeds, or all fail. That is correct ? > Do the Jetty developers have any comments or suggestions? Is there any such > change that would have a chance of being accepted? So far the change looks trivial: a signature change in a yet to be released class that makes it more generic, and a loop in HttpClient.newConnection(). -- Simone Bordet ---- http://cometd.org http://webtide.com Developer advice, training, services and support from the Jetty & CometD experts. _______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
