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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultHostNameSupplier(InetAddress inetAddress)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getFqdnHostName()
Returns the fully-qualified domain name the TaskManager.String
getHostName()
Gets the hostname of the TaskManager.
-
-
-
Constructor Detail
-
DefaultHostNameSupplier
public DefaultHostNameSupplier(InetAddress inetAddress)
-
-
Method Detail
-
getHostName
public String getHostName()
Gets the hostname of the TaskManager. The hostname derives from the fully qualified domain name (FQDN, seeTaskManagerLocation.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 interfaceTaskManagerLocation.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 interfaceTaskManagerLocation.HostNameSupplier
- Returns:
- The fully-qualified domain name of the TaskManager.
-
-