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

Signed-off-by: Erik Krogen <xkrogen@apache.org>
This commit is contained in:
Xing Lin 2022-12-16 08:46:14 -08:00 committed by GitHub
parent c5b42d59d2
commit f7bdf6c667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,8 +68,11 @@ public void onRemoval(
}) })
.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,