HDFS-3009. Remove duplicate code in DFSClient#isLocalAddress by using NetUtils. Contributed by Hari Mankude.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1293390 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2012-02-24 19:29:41 +00:00
parent 62c7e2edfc
commit 0e79131981
2 changed files with 7 additions and 13 deletions

View File

@ -132,12 +132,15 @@ Trunk (unreleased changes)
HDFS-2878. Fix TestBlockRecovery and move it back into main test directory. HDFS-2878. Fix TestBlockRecovery and move it back into main test directory.
(todd) (todd)
HDFS-2655. BlockReaderLocal#skip performs unnecessary IO. (Brandon Li HDFS-2655. BlockReaderLocal#skip performs unnecessary IO.
via jitendra) (Brandon Li via jitendra)
HDFS-3003. Remove getHostPortString() from NameNode, replace it with HDFS-3003. Remove getHostPortString() from NameNode, replace it with
NetUtils.getHostPortString(). (Brandon Li via atm) NetUtils.getHostPortString(). (Brandon Li via atm)
HDFS-3009. Remove duplicate code in DFSClient#isLocalAddress by using
NetUtils. (Hari Mankude via suresh)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-2477. Optimize computing the diff between a block report and the HDFS-2477. Optimize computing the diff between a block report and the
namenode state. (Tomasz Nykiel via hairong) namenode state. (Tomasz Nykiel via hairong)

View File

@ -549,17 +549,8 @@ public class DFSClient implements java.io.Closeable {
return true; return true;
} }
// Check if the address is any local or loop back boolean local = NetUtils.isLocalAddress(addr);
boolean local = addr.isAnyLocalAddress() || addr.isLoopbackAddress();
// Check if the address is defined on any interface
if (!local) {
try {
local = NetworkInterface.getByInetAddress(addr) != null;
} catch (SocketException e) {
local = false;
}
}
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("Address " + targetAddr + " is local"); LOG.trace("Address " + targetAddr + " is local");
} }