From 8746a65e786e48d76864a4182fede0bdf6aee0f3 Mon Sep 17 00:00:00 2001 From: Subru Krishnan Date: Thu, 3 Aug 2017 14:18:03 -0700 Subject: [PATCH] YARN-6932. Fix TestFederationRMFailoverProxyProvider test case failure. (cherry picked from commit 0542e6f86e6734f8ceea00960bebe719827136db) --- .../FederationRMFailoverProxyProvider.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/failover/FederationRMFailoverProxyProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/failover/FederationRMFailoverProxyProvider.java index e00f8d15bf5..c631208b783 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/failover/FederationRMFailoverProxyProvider.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/failover/FederationRMFailoverProxyProvider.java @@ -72,8 +72,7 @@ public class FederationRMFailoverProxyProvider this.rmProxy = proxy; this.protocol = proto; this.rmProxy.checkAllowedProtocols(this.protocol); - String clusterId = - configuration.get(YarnConfiguration.RM_CLUSTER_ID); + String clusterId = configuration.get(YarnConfiguration.RM_CLUSTER_ID); Preconditions.checkNotNull(clusterId, "Missing RM ClusterId"); this.subClusterId = SubClusterId.newInstance(clusterId); this.facade = facade.getInstance(); @@ -197,16 +196,17 @@ public class FederationRMFailoverProxyProvider } private void closeInternal(T currentProxy) { - if ((currentProxy != null) && (currentProxy instanceof Closeable)) { - try { - ((Closeable) currentProxy).close(); - } catch (IOException e) { - LOG.warn("Exception while trying to close proxy", e); + if (currentProxy != null) { + if (currentProxy instanceof Closeable) { + try { + ((Closeable) currentProxy).close(); + } catch (IOException e) { + LOG.warn("Exception while trying to close proxy", e); + } + } else { + RPC.stopProxy(currentProxy); } - } else { - RPC.stopProxy(currentProxy); } - } /**