This is an automated email from the ASF dual-hosted git repository.
HTHou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 1000f953840 Remove deprecated-for-removal JDK API usages (#18288)
1000f953840 is described below
commit 1000f953840b8814c1b2e245e0252ef4216e07f5
Author: Haonan <[email protected]>
AuthorDate: Thu Jul 23 16:19:45 2026 +0800
Remove deprecated-for-removal JDK API usages (#18288)
---
.../org/apache/iotdb/confignode/i18n/ProcedureMessages.java | 3 ---
.../org/apache/iotdb/confignode/i18n/ProcedureMessages.java | 3 ---
.../iotdb/confignode/procedure/ProcedureExecutor.java | 13 ++-----------
.../iotdb/confignode/procedure/TestProcedureExecutor.java | 13 +++++++++++++
.../apache/iotdb/commons/concurrent/IoTThreadFactory.java | 3 +--
5 files changed, 16 insertions(+), 19 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java
b/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java
index c771bb1ad98..8c0be448f7f 100644
---
a/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java
+++
b/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java
@@ -1213,9 +1213,6 @@ public final class ProcedureMessages {
public static final String
LOG_EXCEPTION_HAPPENED_WORKER_ARG_EXECUTE_PROCEDURE_ARG_6E3AD27D = "Exception
happened when worker {} execute procedure {}";
public static final String LOG_WORKER_STUCK_ARG_ARG_RUN_TIME_ARG_MS_FB612354
= "Worker stuck {}({}), run time {} ms";
public static final String
LOG_PROCEDURE_WORKERS_ARG_RUNNING_ARG_RUNNING_STUCK_1565936D = "Procedure
workers: {} is running, {} is running and stuck";
- public static final String
LOG_PROCEDUREEXECUTOR_THREADGROUP_ARG_CONTAINS_RUNNING_THREADS_WHICH_USED_NON_PROCEDURE_BD865211
=
- "ProcedureExecutor threadGroup {} contains running threads which are
used by non-procedure"
- + " module.";
public static final String
LOG_ADD_PROCEDURE_ARG_AS_ARG_TH_ROLLBACK_STEP_C71B2184 = "Add procedure {} as
the {}th rollback step";
public static final String
LOG_STATEMACHINEPROCEDURE_PID_ARG_NOT_SET_NEXT_STATE_BUT_RETURN_HAS_7F93E63F =
"StateMachineProcedure pid={} not set next state, but return
HAS_MORE_STATE. It is likely that"
diff --git
a/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java
b/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java
index 5d20a0b7413..91bf304b326 100644
---
a/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java
+++
b/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java
@@ -1152,9 +1152,6 @@ public final class ProcedureMessages {
"Worker 卡住 {}({}),运行时间 {} ms";
public static final String
LOG_PROCEDURE_WORKERS_ARG_RUNNING_ARG_RUNNING_STUCK_1565936D =
"Procedure workers:{} 正在运行,{} 正在运行且卡住";
- public static final String
-
LOG_PROCEDUREEXECUTOR_THREADGROUP_ARG_CONTAINS_RUNNING_THREADS_WHICH_USED_NON_PROCEDURE_BD865211
=
- "ProcedureExecutor threadGroup {} 包含被非 procedure 模块使用的运行线程。";
public static final String
LOG_ADD_PROCEDURE_ARG_AS_ARG_TH_ROLLBACK_STEP_C71B2184 =
"将 procedure {} 添加为第 {} 个回滚步骤";
public static final String
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java
index 2aca885c391..ea2cea8dfad 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java
@@ -65,7 +65,8 @@ public class ProcedureExecutor<Env> {
private final ConcurrentHashMap<Long, Procedure<Env>> procedures = new
ConcurrentHashMap<>();
- private ThreadGroup threadGroup;
+ private final ThreadGroup threadGroup =
+ new ThreadGroup(ThreadName.CONFIG_NODE_PROCEDURE_WORKER.getName());
private CopyOnWriteArrayList<WorkerThread> workerThreads;
@@ -122,7 +123,6 @@ public class ProcedureExecutor<Env> {
public void init(int numThreads) {
this.corePoolSize = numThreads;
this.maxPoolSize = 10 * numThreads;
- this.threadGroup = new
ThreadGroup(ThreadName.CONFIG_NODE_PROCEDURE_WORKER.getName());
this.timeoutExecutor =
new TimeoutExecutorThread<>(
this, threadGroup,
ThreadName.CONFIG_NODE_TIMEOUT_EXECUTOR.getName());
@@ -1052,15 +1052,6 @@ public class ProcedureExecutor<Env> {
for (WorkerThread workerThread : workerThreads) {
workerThread.awaitTermination();
}
- try {
- threadGroup.destroy();
- } catch (IllegalThreadStateException e) {
- LOG.warn(
- ProcedureMessages
-
.LOG_PROCEDUREEXECUTOR_THREADGROUP_ARG_CONTAINS_RUNNING_THREADS_WHICH_USED_NON_PROCEDURE_BD865211,
- this.threadGroup);
- this.threadGroup.list();
- }
}
public boolean isStarted(long procId) {
diff --git
a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/TestProcedureExecutor.java
b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/TestProcedureExecutor.java
index 95caffd4a9a..692317ffa2b 100644
---
a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/TestProcedureExecutor.java
+++
b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/TestProcedureExecutor.java
@@ -59,6 +59,19 @@ public class TestProcedureExecutor extends TestProcedureBase
{
Assert.assertEquals(acc.get(), 1);
}
+ @Test
+ public void testRestartExecutor() {
+ procExecutor.stop();
+ procExecutor.join();
+
+ procExecutor.init(2);
+ procExecutor.startWorkers();
+
+ long procId = procExecutor.submitProcedure(new NoopProcedure());
+ ProcedureTestUtil.waitForProcedure(procExecutor, procId);
+ Assert.assertTrue(procExecutor.isFinished(procId));
+ }
+
@Test
public void testProcedureFailedDuringSubmissionIsRolledBack() throws
InterruptedException {
TestProcEnv localEnv = new TestProcEnv();
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/IoTThreadFactory.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/IoTThreadFactory.java
index 241b7298675..f7f0f404350 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/IoTThreadFactory.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/IoTThreadFactory.java
@@ -31,8 +31,7 @@ public class IoTThreadFactory implements ThreadFactory {
/** Constructor of IoTThreadFactory. */
public IoTThreadFactory(String poolName) {
- SecurityManager s = System.getSecurityManager();
- group = (s != null) ? s.getThreadGroup() :
Thread.currentThread().getThreadGroup();
+ group = Thread.currentThread().getThreadGroup();
// thread pool name format : pool-number-IoTDB-poolName-thread-
this.namePrefix = "pool-" + poolNumber.getAndIncrement() + "-IoTDB-" +
poolName + "-";
}