Class NetUtils

java.lang.Object
org.elasticsearch.core.internal.net.NetUtils

public class NetUtils extends Object
Utilities for network-related methods.
  • Constructor Details

    • NetUtils

      public NetUtils()
  • Method Details

    • getTcpKeepIdleSocketOptionOrNull

      public static SocketOption<Integer> getTcpKeepIdleSocketOptionOrNull()
      Returns the extended TCP_KEEPIDLE socket option, if available on this JDK
    • getTcpKeepIntervalSocketOptionOrNull

      public static SocketOption<Integer> getTcpKeepIntervalSocketOptionOrNull()
      Returns the extended TCP_KEEPINTERVAL socket option, if available on this JDK
    • getTcpKeepCountSocketOptionOrNull

      public static SocketOption<Integer> getTcpKeepCountSocketOptionOrNull()
      Returns the extended TCP_KEEPCOUNT socket option, if available on this JDK
    • tryEnsureReasonableKeepAliveConfig

      public static void tryEnsureReasonableKeepAliveConfig(NetworkChannel socketChannel)
      If SO_KEEPALIVE is enabled (default), this method ensures sane default values for the extended socket options TCP_KEEPIDLE and TCP_KEEPINTERVAL. The default value for TCP_KEEPIDLE is system dependent, but is typically 2 hours. Such a high value can result in firewalls eagerly closing these connections. To tell any intermediate devices that the connection remains alive, we explicitly set these options to 5 minutes if the defaults are higher than that.