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:
parent
62c7e2edfc
commit
0e79131981
@ -132,12 +132,15 @@ Trunk (unreleased changes)
|
||||
HDFS-2878. Fix TestBlockRecovery and move it back into main test directory.
|
||||
(todd)
|
||||
|
||||
HDFS-2655. BlockReaderLocal#skip performs unnecessary IO. (Brandon Li
|
||||
via jitendra)
|
||||
HDFS-2655. BlockReaderLocal#skip performs unnecessary IO.
|
||||
(Brandon Li via jitendra)
|
||||
|
||||
HDFS-3003. Remove getHostPortString() from NameNode, replace it with
|
||||
NetUtils.getHostPortString(). (Brandon Li via atm)
|
||||
|
||||
HDFS-3009. Remove duplicate code in DFSClient#isLocalAddress by using
|
||||
NetUtils. (Hari Mankude via suresh)
|
||||
|
||||
OPTIMIZATIONS
|
||||
HDFS-2477. Optimize computing the diff between a block report and the
|
||||
namenode state. (Tomasz Nykiel via hairong)
|
||||
|
@ -549,17 +549,8 @@ private static boolean isLocalAddress(InetSocketAddress targetAddr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the address is any local or loop back
|
||||
boolean local = addr.isAnyLocalAddress() || addr.isLoopbackAddress();
|
||||
boolean local = NetUtils.isLocalAddress(addr);
|
||||
|
||||
// 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()) {
|
||||
LOG.trace("Address " + targetAddr + " is local");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user