diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java index d4bfa41b21c4c..03434d57b806e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java @@ -197,7 +197,7 @@ public final class HttpServer2 implements FilterContainer { static final String STATE_DESCRIPTION_ALIVE = " - alive"; static final String STATE_DESCRIPTION_NOT_LIVE = " - not live"; private final SignerSecretProvider secretProvider; - private final Optional configurationChangeMonitor; + private Optional configurationChangeMonitor = Optional.empty(); private XFrameOption xFrameOption; private boolean xFrameOptionIsEnabled; public static final String HTTP_HEADER_PREFIX = "hadoop.http.header."; @@ -258,8 +258,6 @@ public static class Builder { private boolean sniHostCheckEnabled; - private Optional configurationChangeMonitor = Optional.empty(); - public Builder setName(String name){ this.name = name; return this; @@ -547,7 +545,7 @@ public HttpServer2 build() throws IOException { connector = createHttpChannelConnector(server.webServer, httpConfig); } else if (HTTPS_SCHEME.equals(scheme)) { - connector = createHttpsChannelConnector(server.webServer, + connector = createHttpsChannelConnector(server, httpConfig); } else { throw new HadoopIllegalArgumentException( @@ -581,11 +579,11 @@ private ServerConnector createHttpChannelConnector( } private ServerConnector createHttpsChannelConnector( - Server server, HttpConfiguration httpConfig) { + HttpServer2 server, HttpConfiguration httpConfig) { httpConfig.setSecureScheme(HTTPS_SCHEME); httpConfig.addCustomizer( new SecureRequestCustomizer(sniHostCheckEnabled)); - ServerConnector conn = createHttpChannelConnector(server, httpConfig); + ServerConnector conn = createHttpChannelConnector(server.webServer, httpConfig); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); @@ -621,7 +619,7 @@ private ServerConnector createHttpsChannelConnector( if (storesReloadInterval > 0 && (keyStore != null || trustStore != null)) { - this.configurationChangeMonitor = Optional.of( + server.configurationChangeMonitor = Optional.of( this.makeConfigurationChangeMonitor(storesReloadInterval, sslContextFactory)); } @@ -704,7 +702,6 @@ private HttpServer2(final Builder b) throws IOException { this.webAppContext = createWebAppContext(b, adminsAcl, appDir); this.xFrameOptionIsEnabled = b.xFrameEnabled; this.xFrameOption = b.xFrameOption; - this.configurationChangeMonitor = b.configurationChangeMonitor; try { this.secretProvider =