Class TaskManagerLocation.DefaultHostNameSupplier

java.lang.Object
org.apache.flink.runtime.taskmanager.TaskManagerLocation.DefaultHostNameSupplier
All Implemented Interfaces:
Serializable, TaskManagerLocation.HostNameSupplier
Enclosing class:
TaskManagerLocation

@VisibleForTesting public static class TaskManagerLocation.DefaultHostNameSupplier extends Object implements TaskManagerLocation.HostNameSupplier
This Supplier class could retrieve the FQDN host name of the given InetAddress on demand, extract the pure host name and cache the results for later use.
See Also:
  • Constructor Details

    • DefaultHostNameSupplier

      public DefaultHostNameSupplier(InetAddress inetAddress)
  • Method Details

    • getHostName

      public String getHostName()
      Gets the hostname of the TaskManager. The hostname derives from the fully qualified domain name (FQDN, see TaskManagerLocation.getFQDNHostname()):
      • If the FQDN is the textual IP address, then the hostname is also the IP address
      • If the FQDN has only one segment (such as "localhost", or "host17"), then this is used as the hostname.
      • If the FQDN has multiple segments (such as "worker3.subgroup.company.net"), then the first segment (here "worker3") will be used as the hostname.
      Specified by:
      getHostName in interface TaskManagerLocation.HostNameSupplier
      Returns:
      The hostname of the TaskManager.
    • getFqdnHostName

      public String getFqdnHostName()
      Returns the fully-qualified domain name the TaskManager. If the name could not be determined, the return value will be a textual representation of the TaskManager's IP address.
      Specified by:
      getFqdnHostName in interface TaskManagerLocation.HostNameSupplier
      Returns:
      The fully-qualified domain name of the TaskManager.