code: public static InetAddress getLocalAddress() {
          InetAddress localAddress = null;
          try {
              localAddress = InetAddress.getLocalHost();
              if (isValidAddress(localAddress)) {
                  return localAddress;
              }
          } catch (Throwable e) {
              if (LOGGER.isWarnEnabled()) {
                  LOGGER.warn("Error when retrieving ip address: " + e.getMessage(), e);
              }
          }
          try {
              Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
              if (interfaces != null) {
                  while (interfaces.hasMoreElements()) {
                      try {
                          NetworkInterface network = interfaces.nextElement();
                          Enumeration<InetAddress> addresses = network.getInetAddresses();
                          while (addresses.hasMoreElements()) {
                              try {
                                  InetAddress address = addresses.nextElement();
                                  if (isValidAddress(address)) {
                                      return address;
                                  }
                              } catch (Throwable e) {
                                  if (LOGGER.isWarnEnabled()) {
                                      LOGGER.warn("Error when retrieving ip address: " + e.getMessage(), e);
                                  }
                              }
                          }
                      } catch (Throwable e) {
                          if (LOGGER.isWarnEnabled()) {
                              LOGGER.warn("Error when retrieving ip address: " + e.getMessage(), e);
                          }
                      }
                  }
              }
          } catch (Throwable e) {
              if (LOGGER.isWarnEnabled()) {
                  LOGGER.warn("Error when retrieving ip address: " + e.getMessage(), e);
              }
          }
          if (LOGGER.isErrorEnabled()) {
              LOGGER.error("Can't get valid host, will use 127.0.0.1 instead.");
          }
          return localAddress;
      }
docs: 遍历本地网卡，返回第一个合理的IP，保存到缓存中
  
  @return 本地网卡IP