HADOOP-13847. KMSWebApp should close KeyProviderCryptoExtension. Contributed by John Zhuge.
(cherry picked from commit 291df5c7fb
)
This commit is contained in:
parent
b36af9b76c
commit
7e58eec620
|
@ -427,8 +427,9 @@ public class KeyProviderCryptoExtension extends
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
if (getKeyProvider() != null) {
|
KeyProvider provider = getKeyProvider();
|
||||||
getKeyProvider().close();
|
if (provider != null && provider != this) {
|
||||||
|
provider.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ import javax.servlet.ServletContextEvent;
|
||||||
import javax.servlet.ServletContextListener;
|
import javax.servlet.ServletContextListener;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class KMSWebApp implements ServletContextListener {
|
public class KMSWebApp implements ServletContextListener {
|
||||||
|
@ -215,6 +215,11 @@ public class KMSWebApp implements ServletContextListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextDestroyed(ServletContextEvent sce) {
|
public void contextDestroyed(ServletContextEvent sce) {
|
||||||
|
try {
|
||||||
|
keyProviderCryptoExtension.close();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
LOG.error("Error closing KeyProviderCryptoExtension", ioe);
|
||||||
|
}
|
||||||
kmsAudit.shutdown();
|
kmsAudit.shutdown();
|
||||||
kmsAcls.stopReloader();
|
kmsAcls.stopReloader();
|
||||||
jmxReporter.stop();
|
jmxReporter.stop();
|
||||||
|
|
Loading…
Reference in New Issue