public static InetAddress getHostAddress(String hostname) throws UnknownHostException {
    InetAddress serverIPAddress;
    if (hostname != null && !hostname.isEmpty()) {
      serverIPAddress = InetAddress.getByName(hostname);
    } else {
      serverIPAddress = InetAddress.getLocalHost();
    }
    return serverIPAddress;
  }
Get the Inet address of the machine of the given host name.
@param hostname The name of the host
@return The network address of the the host
@throws UnknownHostException
common/src/java/org/apache/hadoop/hive/common/ServerUtils.java