From 29d6c9b7fe00710343f25285ad5bb4469238ed75 Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Fri, 17 May 2024 17:57:31 +0800 Subject: [PATCH] HBASE-26048 [JDK17] Replace the usage of deprecated API ThreadGroup.destroy() --- .../hadoop/hbase/procedure2/ProcedureExecutor.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 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 8a5062be7918..0edfac8e8840 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 @@ -735,14 +735,11 @@ public void join() { Thread.currentThread().interrupt(); } - // 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); - // 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