hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject hadoop git commit: YARN-5728. TestMiniYarnClusterNodeUtilization.testUpdateNodeUtilization timeout.
Date Mon, 31 Jul 2017 02:09:54 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 890e14c02 -> f8bed5e9a


YARN-5728. TestMiniYarnClusterNodeUtilization.testUpdateNodeUtilization timeout.


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

Branch: refs/heads/trunk
Commit: f8bed5e9a7d1ece127fb3da123bbfc26ada0016f
Parents: 890e14c
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Mon Jul 31 11:09:13 2017 +0900
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Mon Jul 31 11:09:13 2017 +0900

----------------------------------------------------------------------
 .../org/apache/hadoop/yarn/server/MiniYARNCluster.java | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/f8bed5e9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
index 329d57e..de282fd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
@@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server;
 import java.io.File;
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 import java.util.Collection;
 import java.util.Map;
@@ -36,6 +37,7 @@ import org.apache.hadoop.fs.FileContext;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.ha.HAServiceProtocol;
 import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.net.ServerSocketUtil;
 import org.apache.hadoop.service.AbstractService;
@@ -446,7 +448,16 @@ public class MiniYARNCluster extends CompositeService {
 
   public static String getHostname() {
     try {
-      return InetAddress.getLocalHost().getHostName();
+      String hostname = InetAddress.getLocalHost().getHostName();
+      // Create InetSocketAddress to see whether it is resolved or not.
+      // If not, just return "localhost".
+      InetSocketAddress addr =
+          NetUtils.createSocketAddrForHost(hostname, 1);
+      if (addr.isUnresolved()) {
+        return "localhost";
+      } else {
+        return hostname;
+      }
     }
     catch (UnknownHostException ex) {
       throw new RuntimeException(ex);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message