flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetz...@apache.org
Subject flink git commit: [hotfix] Use InetAddress.getLocalHost() as first approach when detecting the TMs own ip/hostname
Date Mon, 21 Sep 2015 16:24:01 GMT
Repository: flink
Updated Branches:
  refs/heads/release-0.9 ad09721fb -> f27219e21


[hotfix] Use InetAddress.getLocalHost() as first approach when detecting the TMs own ip/hostname


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/f27219e2
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/f27219e2
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/f27219e2

Branch: refs/heads/release-0.9
Commit: f27219e2174660d58dbd641f1f448349a68a7d4c
Parents: ad09721
Author: Robert Metzger <rmetzger@apache.org>
Authored: Fri Sep 4 14:51:40 2015 +0200
Committer: Robert Metzger <rmetzger@apache.org>
Committed: Mon Sep 21 16:29:30 2015 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/flink/runtime/net/NetUtils.java | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/f27219e2/flink-runtime/src/main/java/org/apache/flink/runtime/net/NetUtils.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/net/NetUtils.java b/flink-runtime/src/main/java/org/apache/flink/runtime/net/NetUtils.java
index 94073db..e4cbbb8 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/net/NetUtils.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/net/NetUtils.java
@@ -183,6 +183,14 @@ public class NetUtils {
 		long currentSleepTime = MIN_SLEEP_TIME;
 		long elapsedTime = 0;
 
+		// before trying with different strategies: test with getLocalHost():
+		InetAddress localhostName = InetAddress.getLocalHost();
+
+		if(tryToConnect(localhostName, targetAddress, AddressDetectionState.ADDRESS.getTimeout(),
false)) {
+			LOG.debug("Using immediately InetAddress.getLocalHost() for the connecting address");
+			return localhostName;
+		}
+
 		// loop while there is time left
 		while (elapsedTime < maxWaitMillis) {
 			AddressDetectionState strategy = AddressDetectionState.ADDRESS;


Mime
View raw message