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
This commit is contained in:
Jitendra Nath Pandey 2012-02-24 08:16:40 +00:00
parent 22d5944c42
commit 584a1ca1f7
2 changed files with 10 additions and 0 deletions

View File

@ -92,6 +92,9 @@ Trunk (unreleased changes)
HADOOP-8085. Add RPC metrics to ProtobufRpcEngine. (Hari Mankude via HADOOP-8085. Add RPC metrics to ProtobufRpcEngine. (Hari Mankude via
suresh) suresh)
HADOOP-8108. Move method getHostPortString() from NameNode to NetUtils.
(Brandon Li via jitendra)
BUG FIXES BUG FIXES
HADOOP-8018. Hudson auto test for HDFS has started throwing javadoc HADOOP-8018. Hudson auto test for HDFS has started throwing javadoc

View File

@ -606,6 +606,13 @@ public static String getHostname() {
catch(UnknownHostException uhe) {return "" + uhe;} 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} * Checks if {@code host} is a local host name and return {@link InetAddress}
* corresponding to that address. * corresponding to that address.