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.
|
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)
|
||||||
|
|
|
@ -548,18 +548,9 @@ public class DFSClient implements java.io.Closeable {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean local = NetUtils.isLocalAddress(addr);
|
||||||
|
|
||||||
// Check if the address is any local or loop back
|
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue