From 998ee771332e2d709e2cbfea51e8248077463f2d Mon Sep 17 00:00:00 2001 From: niuyulin Date: Tue, 18 Aug 2020 11:35:18 -0500 Subject: [PATCH] HBASE-24872 refactor valueOf PoolType (#2250) Signed-off-by: Huaxiang Sun --- .../hadoop/hbase/ipc/AbstractRpcClient.java | 2 +- .../org/apache/hadoop/hbase/util/PoolMap.java | 22 +------------------ 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java index 064664e64d8..bdf08015020 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java @@ -284,7 +284,7 @@ public abstract class AbstractRpcClient implements RpcC */ private static PoolMap.PoolType getPoolType(Configuration config) { return PoolMap.PoolType.valueOf(config.get(HConstants.HBASE_CLIENT_IPC_POOL_TYPE), - PoolMap.PoolType.RoundRobin, PoolMap.PoolType.ThreadLocal); + PoolMap.PoolType.RoundRobin); } /** diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java index 3cd38f34161..cb3bf4ac6d9 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java @@ -27,7 +27,6 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicInteger; @@ -230,27 +229,8 @@ public class PoolMap implements Map { public enum PoolType { ThreadLocal, RoundRobin; - public static PoolType valueOf(String poolTypeName, - PoolType defaultPoolType, PoolType... allowedPoolTypes) { + public static PoolType valueOf(String poolTypeName, PoolType defaultPoolType) { PoolType poolType = PoolType.fuzzyMatch(poolTypeName); - if (poolType != null) { - boolean allowedType = false; - if (poolType.equals(defaultPoolType)) { - allowedType = true; - } else { - if (allowedPoolTypes != null) { - for (PoolType allowedPoolType : allowedPoolTypes) { - if (poolType.equals(allowedPoolType)) { - allowedType = true; - break; - } - } - } - } - if (!allowedType) { - poolType = null; - } - } return (poolType != null) ? poolType : defaultPoolType; }