public static String getHostName ( InetAddress inetAddress ) { String hostName ; String fqdnHostName = getFqdnHostName ( inetAddress ) ; if ( fqdnHostName . equals ( inetAddress . getHostAddress ( ) ) ) { // this happens when the name lookup fails, either due to an exception, // or because no hostname can be found for the address // take IP textual representation hostName = fqdnHostName ; LOG . warn ( "No hostname could be resolved for the IP address {}, using IP address as host name. " + "Local input split assignment (such as for HDFS files) may be impacted." , inetAddress . getHostAddress ( ) ) ; } else { hostName = NetUtils . getHostnameFromFQDN ( fqdnHostName ) ; } return hostName ; }
Gets the hostname of the TaskManager based on the network address .