HADOOP-13847. KMSWebApp should close KeyProviderCryptoExtension. Contributed by John Zhuge.

This commit is contained in:
Xiao Chen 2016-12-05 09:34:39 -08:00
parent c51bfd29cd
commit 291df5c7fb
2 changed files with 9 additions and 3 deletions

View File

@ -427,8 +427,9 @@ public static KeyProviderCryptoExtension createKeyProviderCryptoExtension(
@Override
public void close() throws IOException {
if (getKeyProvider() != null) {
getKeyProvider().close();
KeyProvider provider = getKeyProvider();
if (provider != null && provider != this) {
provider.close();
}
}

View File

@ -40,9 +40,9 @@
import javax.servlet.ServletContextListener;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.List;
@InterfaceAudience.Private
public class KMSWebApp implements ServletContextListener {
@ -215,6 +215,11 @@ public void contextInitialized(ServletContextEvent sce) {
@Override
public void contextDestroyed(ServletContextEvent sce) {
try {
keyProviderCryptoExtension.close();
} catch (IOException ioe) {
LOG.error("Error closing KeyProviderCryptoExtension", ioe);
}
kmsAudit.shutdown();
kmsAcls.stopReloader();
jmxReporter.stop();