java.lang.Object
org.elasticsearch.transport.netty4.NetUtils

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

    • getTcpKeepIdleSocketOption

      public static SocketOption<Integer> getTcpKeepIdleSocketOption()
      Returns the extended TCP_KEEPIDLE socket option.
    • getTcpKeepIntervalSocketOption

      public static SocketOption<Integer> getTcpKeepIntervalSocketOption()
      Returns the extended TCP_KEEPINTERVAL socket option.
    • getTcpKeepCountSocketOption

      public static SocketOption<Integer> getTcpKeepCountSocketOption()
      Returns the extended TCP_KEEPCOUNT socket option.
    • 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.