kylemeow commented on a change in pull request #13706:
URL: https://github.com/apache/flink/pull/13706#discussion_r510138152
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/TaskManagerLocation.java
##########
@@ -150,28 +165,48 @@ public String addressString() {
/**
* 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.
+ * determined or {@link #retrieveHostName} is set to false,
+ * the return value will be a textual representation of the
TaskManager's IP address.
*
* @return The fully-qualified domain name of the TaskManager.
*/
public String getFQDNHostname() {
+ // Lazily retrieve FQDN host name of this TaskManager
+ if (fqdnHostName == null) {
+ if (!retrieveHostName) {
+ fqdnHostName = inetAddress.getHostAddress();
+ } else {
+ fqdnHostName = getFqdnHostName(inetAddress);
+ }
+ }
Review comment:
Thanks Till for the valuable suggestions, and I agree that by extracting
the hostname retrieval code into some Supplier-like classes could make the
logics simpler and more intuitive.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]