Class ResolveAllBootstrap

  • All Implemented Interfaces:

    public class ResolveAllBootstrap
    extends InstrumentedBootstrap
    The existing Netty Bootstrap has a limitation regarding connecting to remote hosts where the hostname resolves to more than one IP address. It will only try one resolved address and then fail if the connection cannot be established. This is a problem for us: If we have a service which is bound to the IPv4 address and the IPv6 address is added to the DNS, attempts to connect to the machine are likely to fail. This bootstrap will attempt to do the right thing by attempting to connect using each of the resolved IP addresses. A sort comparator may be provided to encourage preference in the order of connect attempts. To conform to de-facto standards, one should provide a comparator which will sort IPv6 addresses first. Created by acurtis on 4/20/18.
    • Field Summary

      Modifier and Type Field Description
      static io.netty.util.AttributeKey<java.util.Comparator<>> SORT_KEY  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      io.netty.bootstrap.Bootstrap clone​( group) connect()
      Connect a Channel to the remote peer. connect​( remoteAddress)
      Connect a Channel to the remote peer. connect​( remoteAddress, localAddress)
      Connect a Channel to the remote peer.
      io.netty.bootstrap.Bootstrap sortResolvedAddress​(java.util.Comparator<> comparator)  
      • Methods inherited from class io.netty.bootstrap.Bootstrap

        config, connect, connect, remoteAddress, remoteAddress, remoteAddress, resolver, validate
      • Methods inherited from class io.netty.bootstrap.AbstractBootstrap

        attr, bind, bind, bind, bind, bind, channel, channelFactory, channelFactory, group, group, handler, localAddress, localAddress, localAddress, localAddress, option, register, toString
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • SORT_KEY

        public static final io.netty.util.AttributeKey<java.util.Comparator<>> SORT_KEY
    • Constructor Detail

      • ResolveAllBootstrap

        public ResolveAllBootstrap​(@Nonnull
                                   CallTracker connectCallTracker,
                                   CallTracker resolveCallTracker)
        Constructor for the bootstrap.
        connectCallTracker - CallTracker for connect operations.
        resolveCallTracker - CallTracker for resolveAll operations.
      • ResolveAllBootstrap

        public ResolveAllBootstrap​(@Nonnull
                                   java.util.function.Function<,​CallTracker> connectCallTracker,
                                   java.util.function.Function<,​CallTracker> resolveCallTracker)
        Constructor for the bootstrap
        connectCallTracker - provide CallTracker for connect operations. Function must not return null.
        resolveCallTracker - provide CallTracker for resolveAll operations. Function must not return null.
    • Method Detail

      • sortResolvedAddress

        public io.netty.bootstrap.Bootstrap sortResolvedAddress​(@Nonnull
                                                                java.util.Comparator<> comparator)
      • connect

        public connect​( remoteAddress,
        Description copied from class: InstrumentedBootstrap
        Connect a Channel to the remote peer.
        connect in class InstrumentedBootstrap
      • clone

        public io.netty.bootstrap.Bootstrap clone​( group)
        clone in class InstrumentedBootstrap