Skip to content

Commit d665d11

Browse files
author
Haohui Mai
committed
HADOOP-11815. HttpServer2 should destroy SignerSecretProvider when it stops. Contributed by Rohith.
1 parent 9a111fc commit d665d11

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

hadoop-common-project/hadoop-common/CHANGES.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,10 @@ Release 2.7.0 - UNRELEASED
729729

730730
HADOOP-11796. Skip TestShellBasedIdMapping.testStaticMapUpdate on Windows.
731731
(Xiaoyu Yao via cnauroth)
732-
732+
733+
HADOOP-11815. HttpServer2 should destroy SignerSecretProvider when it
734+
stops. (Rohith via wheat9)
735+
733736
Release 2.6.1 - UNRELEASED
734737

735738
INCOMPATIBLE CHANGES

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public final class HttpServer2 implements FilterContainer {
140140
protected final List<String> filterNames = new ArrayList<>();
141141
static final String STATE_DESCRIPTION_ALIVE = " - alive";
142142
static final String STATE_DESCRIPTION_NOT_LIVE = " - not live";
143+
private final SignerSecretProvider secretProvider;
143144

144145
/**
145146
* Class to construct instances of HTTP server with specific options.
@@ -335,7 +336,7 @@ private HttpServer2(final Builder b) throws IOException {
335336
this.adminsAcl = b.adminsAcl;
336337
this.webAppContext = createWebAppContext(b.name, b.conf, adminsAcl, appDir);
337338
try {
338-
SignerSecretProvider secretProvider =
339+
this.secretProvider =
339340
constructSecretProvider(b, webAppContext.getServletContext());
340341
this.webAppContext.getServletContext().setAttribute
341342
(AuthenticationFilter.SIGNER_SECRET_PROVIDER_ATTRIBUTE,
@@ -945,6 +946,8 @@ public void stop() throws Exception {
945946
}
946947

947948
try {
949+
// explicitly destroy the secrete provider
950+
secretProvider.destroy();
948951
// clear & stop webAppContext attributes to avoid memory leaks.
949952
webAppContext.clearAttributes();
950953
webAppContext.stop();

0 commit comments

Comments
 (0)