HDFS-2624. ConfiguredFailoverProxyProvider doesn't correctly stop ProtocolTranslators. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1210341 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2011-12-05 06:37:46 +00:00
parent b3f28dbb3d
commit c7f5167845
3 changed files with 10 additions and 2 deletions

View File

@ -41,3 +41,5 @@ HDFS-2612. Handle refreshNameNodes in federated HA clusters (todd)
HDFS-2623. Add test case for hot standby capability (todd)
HDFS-2626. BPOfferService.verifyAndSetNamespaceInfo needs to be synchronized (todd)
HDFS-2624. ConfiguredFailoverProxyProvider doesn't correctly stop ProtocolTranslators (todd)

View File

@ -439,8 +439,9 @@ void closeConnectionToNamenode() {
// fall through - lets try the stopProxy
LOG.warn("Exception closing namenode, stopping the proxy");
}
} else {
RPC.stopProxy(namenode);
}
RPC.stopProxy(namenode);
}
/** Abort and release resources held. Ignore all errors. */

View File

@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hdfs.server.namenode.ha;
import java.io.Closeable;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.ArrayList;
@ -126,7 +127,11 @@ public AddressRpcProxyPair(InetSocketAddress address) {
public synchronized void close() throws IOException {
for (AddressRpcProxyPair proxy : proxies) {
if (proxy.namenode != null) {
RPC.stopProxy(proxy.namenode);
if (proxy.namenode instanceof Closeable) {
((Closeable)proxy.namenode).close();
} else {
RPC.stopProxy(proxy.namenode);
}
}
}
}