Class UnicastZenPing

  • All Implemented Interfaces:, java.lang.AutoCloseable, Releasable, ZenPing

    public class UnicastZenPing
    extends java.lang.Object
    implements ZenPing
    • Field Detail


        public static final Setting<java.lang.Integer> DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING

        public static final Setting<TimeValue> DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT
    • Method Detail

      • resolveHostsLists

        public static java.util.List<TransportAddress> resolveHostsLists​(java.util.concurrent.ExecutorService executorService,
                                                                         org.apache.logging.log4j.Logger logger,
                                                                         java.util.List<java.lang.String> hosts,
                                                                         int limitPortCounts,
                                                                         TransportService transportService,
                                                                         TimeValue resolveTimeout)
        Resolves a list of hosts to a list of transport addresses. Each host is resolved into a transport address (or a collection of addresses if the number of ports is greater than one). Host lookups are done in parallel using specified executor service up to the specified resolve timeout.
        executorService - the executor service used to parallelize hostname lookups
        logger - logger used for logging messages regarding hostname lookups
        hosts - the hosts to resolve
        limitPortCounts - the number of ports to resolve (should be 1 for non-local transport)
        transportService - the transport service
        resolveTimeout - the timeout before returning from hostname lookups
        a list of resolved transport addresses
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface
        Specified by:
        close in interface Releasable
      • start

        public void start()
        Specified by:
        start in interface ZenPing
      • clearTemporalResponses

        public void clearTemporalResponses()
        Clears the list of cached ping responses.
      • ping

        public void ping​(java.util.function.Consumer<ZenPing.PingCollection> resultsConsumer,
                         TimeValue duration)
        Sends three rounds of pings notifying the specified Consumer when pinging is complete. Pings are sent after resolving configured unicast hosts to their IP address (subject to DNS caching within the JVM). A batch of pings is sent, then another batch of pings is sent at half the specified TimeValue, and then another batch of pings is sent at the specified TimeValue. The pings that are sent carry a timeout of 1.25 times the specified TimeValue. When pinging each node, a connection and handshake is performed, with a connection timeout of the specified TimeValue.
        Specified by:
        ping in interface ZenPing
        resultsConsumer - the callback when pinging is complete
        duration - the timeout for various components of the pings
      • submitToExecutor

        protected void submitToExecutor​(AbstractRunnable abstractRunnable)
      • getVersion

        protected Version getVersion()