HDFS-2653. svn merge -c 1213586 from trunk
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1213589 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
88f815fc54
commit
a3af423143
|
@ -88,6 +88,9 @@ Release 0.23.1 - UNRELEASED
|
|||
|
||||
HDFS-2614. hadoop dist tarball is missing hdfs headers. (tucu)
|
||||
|
||||
HDFS-2653. DFSClient should cache whether addrs are non-local when
|
||||
short-circuiting is enabled. (eli)
|
||||
|
||||
Release 0.23.0 - 2011-11-01
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -32,10 +32,8 @@ import java.net.SocketException;
|
|||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.net.SocketFactory;
|
||||
|
||||
|
@ -514,12 +512,13 @@ public class DFSClient implements java.io.Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
private static Set<String> localIpAddresses = Collections
|
||||
.synchronizedSet(new HashSet<String>());
|
||||
private static Map<String, Boolean> localAddrMap = Collections
|
||||
.synchronizedMap(new HashMap<String, Boolean>());
|
||||
|
||||
private static boolean isLocalAddress(InetSocketAddress targetAddr) {
|
||||
InetAddress addr = targetAddr.getAddress();
|
||||
if (localIpAddresses.contains(addr.getHostAddress())) {
|
||||
Boolean cached = localAddrMap.get(addr.getHostAddress());
|
||||
if (cached != null && cached) {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Address " + targetAddr + " is local");
|
||||
}
|
||||
|
@ -540,9 +539,7 @@ public class DFSClient implements java.io.Closeable {
|
|||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Address " + targetAddr + " is local");
|
||||
}
|
||||
if (local == true) {
|
||||
localIpAddresses.add(addr.getHostAddress());
|
||||
}
|
||||
localAddrMap.put(addr.getHostAddress(), local);
|
||||
return local;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue