Class IcmpFailureDetectorConfig

java.lang.Object
com.hazelcast.config.IcmpFailureDetectorConfig

public class IcmpFailureDetectorConfig extends Object
This Failure Detector may be configured in addition to one of Deadline and Phi Accrual Failure Detectors.
It operates at Layer 3 of the OSI protocol, and provides much quicker and more deterministic detection of hardware
and other lower level events. This detector may be configured to perform an extra check after a member is suspected by one
of the other detectors, or it can work in parallel, which is the default. This way hardware and network level issues
will be detected more quickly.

This failure detector is based on InetAddress.isReachable(). When the JVM process has enough permissions to create RAW sockets, the implementation will choose to rely on ICMP Echo requests. This is preferred. However, if there are not enough permissions, it can be configured to fallback on attempting a TCP Echo on port 7. In the latter case, both a successful connection or an explicit rejection will be treated as "Host is Reachable". This is not preferred as each call creates a heavyweight socket and moreover the Echo service is typically disabled.

For the Ping Failure Detector to rely only on ICMP (RAW sockets) Echo requests, there are some criteria that need to be met. Please consult the Hazelcast Reference Manual on how to configure and what the OS requirements are.

  • Constructor Details

    • IcmpFailureDetectorConfig

      public IcmpFailureDetectorConfig()
  • Method Details

    • getTimeoutMilliseconds

      public int getTimeoutMilliseconds()
      Returns:
      the timeout in Milliseconds before declaring a failed ping
    • setTimeoutMilliseconds

      public IcmpFailureDetectorConfig setTimeoutMilliseconds(int timeoutMilliseconds)
      Sets the timeout in Milliseconds before declaring a failed ping This cannot be more than the interval value. Should always be smaller.
      Parameters:
      timeoutMilliseconds - the timeout for each ping in millis
      Returns:
      this IcmpFailureDetectorConfig instance
    • getIntervalMilliseconds

      public int getIntervalMilliseconds()
      Returns:
      the time in milliseconds between each ping
    • setIntervalMilliseconds

      public IcmpFailureDetectorConfig setIntervalMilliseconds(int intervalMilliseconds)
      Sets the time in milliseconds between each ping This value can not be smaller than 1000 milliseconds
      Parameters:
      intervalMilliseconds - the interval millis between each ping
      Returns:
      this IcmpFailureDetectorConfig instance
    • isFailFastOnStartup

      public boolean isFailFastOnStartup()
      Returns:
      whether the member should fail-fast on startup if ICMP is not allowed by the underlying OS.
    • setFailFastOnStartup

      public IcmpFailureDetectorConfig setFailFastOnStartup(boolean failFastOnStartup)
      Sets whether the member should fail-fast on startup if ICMP is not allowed by the underlying OS. Failure is usually due to OS level restrictions.
      Parameters:
      failFastOnStartup - the fail-fast flag
      Returns:
      this IcmpFailureDetectorConfig instance
    • getTtl

      public int getTtl()
      Returns:
      the maximum number of times the IP Datagram (ping) can be forwarded
    • setTtl

      public IcmpFailureDetectorConfig setTtl(int ttl)
      Sets the maximum number of times the IP Datagram (ping) can be forwarded, in most cases all Hazelcast cluster members would be within one network switch/router therefore
      Parameters:
      ttl - the new time-to-live value
      Returns:
      this IcmpFailureDetectorConfig instance
    • getMaxAttempts

      public int getMaxAttempts()
      Returns:
      max ping attempts before suspecting a member
    • setMaxAttempts

      public IcmpFailureDetectorConfig setMaxAttempts(int maxAttempts)
      Set the max ping attempts before suspecting a member
      Parameters:
      maxAttempts - the max attempts before suspecting a member
      Returns:
      this IcmpFailureDetectorConfig instance
    • isEnabled

      public boolean isEnabled()
      Returns:
      whether the ICMP detector is enabled or not.
    • setEnabled

      public IcmpFailureDetectorConfig setEnabled(boolean enabled)
      Set whether the ICMP failure detector should be enabled or not. When set to true, this member will use icmp ping failure detector to detect unavailable members
    • isParallelMode

      public boolean isParallelMode()
      Returns:
      whether the ICMP detector is set in parallel mode, or in legacy (flag value = false).
    • setParallelMode

      public IcmpFailureDetectorConfig setParallelMode(boolean mode)
      Set the ICMP detector to run in parallel mode, independent from the other failure detectors. If set to false (default) then the detector runs in legacy mode, with similar behavior as to Hazelcast version less than 3.9.
      Parameters:
      mode - the mode representing whether the detector should work in parallel or not
      Returns:
      this IcmpFailureDetectorConfig instance
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object