HDFS-16852. Skip KeyProviderCache shutdown hook registration if already shutting down (#5160)

Signed-off-by: Erik Krogen <xkrogen@apache.org>

(cherry picked from commit f7bdf6c667)
This commit is contained in:
Xing Lin 2022-12-16 08:46:14 -08:00 committed by Erik Krogen
parent daa33aafff
commit d43fa95043
1 changed files with 5 additions and 2 deletions

View File

@ -68,8 +68,11 @@ public class KeyProviderCache {
}) })
.build(); .build();
ShutdownHookManager.get().addShutdownHook(new KeyProviderCacheFinalizer(), // Register the shutdown hook when not in shutdown
SHUTDOWN_HOOK_PRIORITY); if (!ShutdownHookManager.get().isShutdownInProgress()) {
ShutdownHookManager.get().addShutdownHook(
new KeyProviderCacheFinalizer(), SHUTDOWN_HOOK_PRIORITY);
}
} }
public KeyProvider get(final Configuration conf, public KeyProvider get(final Configuration conf,