You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2024/05/17 16:10:36 UTC

(hbase) branch branch-2.4 updated: HBASE-26048 [JDK17] Replace the usage of deprecated API ThreadGroup.destroy() (#5913)

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

zhangduo pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new bd9d9c99301 HBASE-26048 [JDK17] Replace the usage of deprecated API ThreadGroup.destroy() (#5913)
bd9d9c99301 is described below

commit bd9d9c99301a45e57db027e23102f9a6705f6b6b
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Fri May 17 23:35:14 2024 +0800

    HBASE-26048 [JDK17] Replace the usage of deprecated API ThreadGroup.destroy() (#5913)
    
    Signed-off-by: Xin Sun <su...@apache.org>
    (cherry picked from commit 6c84d3960ff143f9bdd11b8143a6bab505c4e165)
---
 .../apache/hadoop/hbase/procedure2/ProcedureExecutor.java  | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java
index abadd0865a1..58dd653a6a5 100644
--- a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java
+++ b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java
@@ -691,15 +691,11 @@ public class ProcedureExecutor<TEnvironment> {
       worker.awaitTermination();
     }
 
-    // Destroy the Thread Group for the executors
-    // TODO: Fix. #join is not place to destroy resources.
-    try {
-      threadGroup.destroy();
-    } catch (IllegalThreadStateException e) {
-      LOG.error("ThreadGroup {} contains running threads; {}: See STDOUT", this.threadGroup,
-        e.getMessage());
-      // This dumps list of threads on STDOUT.
-      this.threadGroup.list();
+    // log the still active threads, ThreadGroup.destroy is deprecated in JDK17 and it is not
+    // necessary for us to must destroy it here, so we just do a check and log
+    if (threadGroup.activeCount() > 0) {
+      LOG.error("There are still active thread in group {}, see STDOUT", threadGroup);
+      threadGroup.list();
     }
 
     // reset the in-memory state for testing