From 3fdf153036d809aa464b3d6b2457f3dae90024db Mon Sep 17 00:00:00 2001 From: weitang Date: Fri, 25 Apr 2025 08:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iec104/core/OptimizedThreadPool.java | 8 +++++--- .../impl/DeviceWorkDataServiceImpl.java | 18 +++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/riis-system/src/main/java/com/yfd/platform/component/iec104/core/OptimizedThreadPool.java b/riis-system/src/main/java/com/yfd/platform/component/iec104/core/OptimizedThreadPool.java index 3a521a9..2a4e30c 100644 --- a/riis-system/src/main/java/com/yfd/platform/component/iec104/core/OptimizedThreadPool.java +++ b/riis-system/src/main/java/com/yfd/platform/component/iec104/core/OptimizedThreadPool.java @@ -1,5 +1,7 @@ package com.yfd.platform.component.iec104.core; +import org.jetbrains.annotations.NotNull; + import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; @@ -54,7 +56,7 @@ public final class OptimizedThreadPool { public void execute(Runnable task) { // 添加基础校验(生产环境可扩展) if (task == null) { - throw new IllegalArgumentException("Task cannot be null"); + throw new IllegalArgumentException("任务不能为空"); } // 添加异常处理包装 @@ -70,7 +72,7 @@ public final class OptimizedThreadPool { task.run(); } catch (Exception e) { // 统一的异常处理(建议接入日志系统) - System.err.println("Task execution failed: " + e.getMessage()); + System.err.println("任务执行失败: " + e.getMessage()); e.printStackTrace(); } }; @@ -115,7 +117,7 @@ public final class OptimizedThreadPool { private static final String THREAD_NAME_PREFIX = "optimized-pool-thread-"; @Override - public Thread newThread(Runnable r) { + public Thread newThread(@NotNull Runnable r) { Thread thread = new Thread(r, THREAD_NAME_PREFIX + threadCounter.getAndIncrement()); thread.setDaemon(false); // 非守护线程 thread.setPriority(Thread.NORM_PRIORITY); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceWorkDataServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceWorkDataServiceImpl.java index 3d4cc3c..99d18dc 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceWorkDataServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceWorkDataServiceImpl.java @@ -55,15 +55,15 @@ public class DeviceWorkDataServiceImpl extends ServiceImpl