Skip to content

Commit d43fa95

Browse files
xinglinxkrogen
authored andcommitted
HDFS-16852. Skip KeyProviderCache shutdown hook registration if already shutting down (#5160)
Signed-off-by: Erik Krogen <[email protected]> (cherry picked from commit f7bdf6c)
1 parent daa33aa commit d43fa95

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/KeyProviderCache.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ public void onRemoval(
6868
})
6969
.build();
7070

71-
ShutdownHookManager.get().addShutdownHook(new KeyProviderCacheFinalizer(),
72-
SHUTDOWN_HOOK_PRIORITY);
71+
// Register the shutdown hook when not in shutdown
72+
if (!ShutdownHookManager.get().isShutdownInProgress()) {
73+
ShutdownHookManager.get().addShutdownHook(
74+
new KeyProviderCacheFinalizer(), SHUTDOWN_HOOK_PRIORITY);
75+
}
7376
}
7477

7578
public KeyProvider get(final Configuration conf,

0 commit comments

Comments
 (0)