YARN-6932. Fix TestFederationRMFailoverProxyProvider test case failure.

(cherry picked from commit 0542e6f86e6734f8ceea00960bebe719827136db)
This commit is contained in:
Subru Krishnan 2017-08-03 14:18:03 -07:00 committed by Arun Suresh
parent 2d8d420f26
commit 656ab06873

View File

@ -72,8 +72,7 @@ public void init(Configuration configuration, RMProxy<T> proxy,
this.rmProxy = proxy; this.rmProxy = proxy;
this.protocol = proto; this.protocol = proto;
this.rmProxy.checkAllowedProtocols(this.protocol); this.rmProxy.checkAllowedProtocols(this.protocol);
String clusterId = String clusterId = configuration.get(YarnConfiguration.RM_CLUSTER_ID);
configuration.get(YarnConfiguration.RM_CLUSTER_ID);
Preconditions.checkNotNull(clusterId, "Missing RM ClusterId"); Preconditions.checkNotNull(clusterId, "Missing RM ClusterId");
this.subClusterId = SubClusterId.newInstance(clusterId); this.subClusterId = SubClusterId.newInstance(clusterId);
this.facade = facade.getInstance(); this.facade = facade.getInstance();
@ -197,16 +196,17 @@ public Class<T> getInterface() {
} }
private void closeInternal(T currentProxy) { private void closeInternal(T currentProxy) {
if ((currentProxy != null) && (currentProxy instanceof Closeable)) { if (currentProxy != null) {
try { if (currentProxy instanceof Closeable) {
((Closeable) currentProxy).close(); try {
} catch (IOException e) { ((Closeable) currentProxy).close();
LOG.warn("Exception while trying to close proxy", e); } catch (IOException e) {
LOG.warn("Exception while trying to close proxy", e);
}
} else {
RPC.stopProxy(currentProxy);
} }
} else {
RPC.stopProxy(currentProxy);
} }
} }
/** /**