This is an automated email from the ASF dual-hosted git repository.

xkrogen pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.3 by this push:
     new d43fa950435 HDFS-16852. Skip KeyProviderCache shutdown hook 
registration if already shutting down (#5160)
d43fa950435 is described below

commit d43fa9504350a5ec5b7f8e62a22f517b3749e172
Author: Xing Lin <linxing...@gmail.com>
AuthorDate: Fri Dec 16 08:46:14 2022 -0800

    HDFS-16852. Skip KeyProviderCache shutdown hook registration if already 
shutting down (#5160)
    
    Signed-off-by: Erik Krogen <xkro...@apache.org>
    
    (cherry picked from commit f7bdf6c667d503c0eebbc3efcdfe4ba6bf2d6275)
---
 .../src/main/java/org/apache/hadoop/hdfs/KeyProviderCache.java     | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/KeyProviderCache.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/KeyProviderCache.java
index 62902f2a7eb..48afed18161 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/KeyProviderCache.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/KeyProviderCache.java
@@ -68,8 +68,11 @@ public class KeyProviderCache {
         })
         .build();
 
-    ShutdownHookManager.get().addShutdownHook(new KeyProviderCacheFinalizer(),
-        SHUTDOWN_HOOK_PRIORITY);
+    // Register the shutdown hook when not in shutdown
+    if (!ShutdownHookManager.get().isShutdownInProgress()) {
+      ShutdownHookManager.get().addShutdownHook(
+          new KeyProviderCacheFinalizer(), SHUTDOWN_HOOK_PRIORITY);
+    }
   }
 
   public KeyProvider get(final Configuration conf,


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to