HDFS-16323. DatanodeHttpServer doesn't require handler state map while retrieving filter handlers (#3659)
This commit is contained in:
parent
54a1d78e16
commit
646c470e5d
@ -64,7 +64,6 @@
|
||||
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 @@
|
||||
*/
|
||||
public class DatanodeHttpServer implements Closeable {
|
||||
static final Logger LOG = LoggerFactory.getLogger(DatanodeHttpServer.class);
|
||||
private static final ConcurrentHashMap<Class<?>, Object> HANDLER_STATE
|
||||
= new ConcurrentHashMap<Class<?>, 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 @@ private ChannelHandler[] getFilterHandlers(Configuration configuration) {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user