Browse Source

HADOOP-8108. Move method getHostPortString() from NameNode to NetUtils. Contributed by Brandon Li

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1327139 13f79535-47bb-0310-9956-ffa450edef68
Robert Joseph Evans 13 years ago
parent
commit
a66bfb7f32

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -8,6 +8,9 @@ Release 0.23.3 - UNRELEASED
 
   IMPROVEMENTS
 
+    HADOOP-8108. Move method getHostPortString() from NameNode to NetUtils.
+    (Brandon Li via jitendra and bobby)
+
   OPTIMIZATIONS
 
   BUG FIXES

+ 7 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java

@@ -611,6 +611,13 @@ public class NetUtils {
     catch(UnknownHostException uhe) {return "" + uhe;}
   }
   
+  /**
+   * Compose a "host:port" string from the address.
+   */
+  public static String getHostPortString(InetSocketAddress addr) {
+    return addr.getHostName() + ":" + addr.getPort();
+  }
+  
   /**
    * Checks if {@code host} is a local host name and return {@link InetAddress}
    * corresponding to that address.