HDFS-13664. Refactor ConfiguredFailoverProxyProvider to make inheritance easier. Contributed by Chao Sun.
(cherry picked from commit fba1c42adc1c8ae57951e1865ec2ab05c8707bdf) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d827ffe2 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d827ffe2 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d827ffe2 Branch: refs/remotes/origin/branch-3.1 Commit: d827ffe2450887e4a51c200667e2cfa69b57d07d Parents: 63c20f9 Author: Chao Sun <sunc...@apache.org> Authored: Fri Jun 8 16:36:42 2018 -0700 Committer: Konstantin V Shvachko <s...@apache.org> Committed: Fri Jun 8 16:40:13 2018 -0700 ---------------------------------------------------------------------- .../namenode/ha/ConfiguredFailoverProxyProvider.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/d827ffe2/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ConfiguredFailoverProxyProvider.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ConfiguredFailoverProxyProvider.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ConfiguredFailoverProxyProvider.java index e9c8791..58f4943 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ConfiguredFailoverProxyProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ConfiguredFailoverProxyProvider.java @@ -52,11 +52,11 @@ public class ConfiguredFailoverProxyProvider<T> extends protected final Configuration conf; protected final List<AddressRpcProxyPair<T>> proxies = new ArrayList<AddressRpcProxyPair<T>>(); - private final UserGroupInformation ugi; + protected final UserGroupInformation ugi; protected final Class<T> xface; private int currentProxyIndex = 0; - private final HAProxyFactory<T> factory; + protected final HAProxyFactory<T> factory; public ConfiguredFailoverProxyProvider(Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory) { @@ -122,6 +122,10 @@ public class ConfiguredFailoverProxyProvider<T> extends @Override public synchronized ProxyInfo<T> getProxy() { AddressRpcProxyPair<T> current = proxies.get(currentProxyIndex); + return getProxy(current); + } + + protected ProxyInfo<T> getProxy(AddressRpcProxyPair<T> current) { if (current.namenode == null) { try { current.namenode = factory.createProxy(conf, @@ -147,7 +151,7 @@ public class ConfiguredFailoverProxyProvider<T> extends * A little pair object to store the address and connected RPC proxy object to * an NN. Note that {@link AddressRpcProxyPair#namenode} may be null. */ - private static class AddressRpcProxyPair<T> { + protected static class AddressRpcProxyPair<T> { public final InetSocketAddress address; public T namenode; --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org