From 4e77f772fced9012632f2f4a4e8968a543c9360b Mon Sep 17 00:00:00 2001 From: Viraj Jasani Date: Wed, 17 Nov 2021 18:47:09 +0530 Subject: [PATCH] HDFS-16323. DatanodeHttpServer doesn't require handler state map while retrieving filter handlers (#3659) (cherry picked from commit 646c470e5de956e570a81dcd4890f028965be33a) --- .../hdfs/server/datanode/web/DatanodeHttpServer.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java index e4a0c209762..46656c178a9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java @@ -64,7 +64,6 @@ import java.nio.channels.ServerSocketChannel; import java.security.GeneralSecurityException; import java.util.Enumeration; import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_ADMIN; import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTPS_ADDRESS_DEFAULT; @@ -77,8 +76,6 @@ import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTP_INTERNAL_PR */ public class DatanodeHttpServer implements Closeable { static final Logger LOG = LoggerFactory.getLogger(DatanodeHttpServer.class); - private static final ConcurrentHashMap, Object> HANDLER_STATE - = new ConcurrentHashMap, Object>() {}; // HttpServer threads are only used for the web UI and basic servlets, so // set them to the minimum possible private static final int HTTP_SELECTOR_THREADS = 1; @@ -281,11 +278,10 @@ public class DatanodeHttpServer implements Closeable { try { Method initializeState = classes[i].getDeclaredMethod("initializeState", Configuration.class); - Constructor constructor = + Constructor constructor = classes[i].getDeclaredConstructor(initializeState.getReturnType()); handlers[i] = (ChannelHandler) constructor.newInstance( - HANDLER_STATE.getOrDefault(classes[i], - initializeState.invoke(null, configuration))); + initializeState.invoke(null, configuration)); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException | IllegalArgumentException e) {