From 584a1ca1f75f86b05ada98e8ead1973e5cf9cbc9 Mon Sep 17 00:00:00 2001 From: Jitendra Nath Pandey Date: Fri, 24 Feb 2012 08:16:40 +0000 Subject: [PATCH] HADOOP-8108. Move method getHostPortString() from NameNode to NetUtils. Contributed by Brandon Li. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1293128 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/net/NetUtils.java | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index a608c8dd350..3aea617ed12 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -92,6 +92,9 @@ Trunk (unreleased changes) HADOOP-8085. Add RPC metrics to ProtobufRpcEngine. (Hari Mankude via suresh) + HADOOP-8108. Move method getHostPortString() from NameNode to NetUtils. + (Brandon Li via jitendra) + BUG FIXES HADOOP-8018. Hudson auto test for HDFS has started throwing javadoc diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java index f71c1894adc..0bfeaa7cfcd 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java @@ -606,6 +606,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.