From ed1931cd98ec798aac90006f6321d24dce3e7c1f Mon Sep 17 00:00:00 2001 From: wangshilong Date: Tue, 18 Feb 2025 09:19:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4NettyServer=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iot/modbus_rtcp/controller/ModbusTCPController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/iot/modbus_rtcp/controller/ModbusTCPController.java b/src/main/java/com/iot/modbus_rtcp/controller/ModbusTCPController.java index 65e8830..e8f2180 100644 --- a/src/main/java/com/iot/modbus_rtcp/controller/ModbusTCPController.java +++ b/src/main/java/com/iot/modbus_rtcp/controller/ModbusTCPController.java @@ -24,7 +24,7 @@ import java.util.Set; @RestController @RequestMapping("modbus-tcp") public class ModbusTCPController implements ApplicationRunner { - public static final NettyServer nettyServer = new NettyServer(502, Math.max(20, Runtime.getRuntime().availableProcessors() - 1)); + public static NettyServer nettyServer; @PreDestroy private void destroy() { @@ -105,6 +105,7 @@ public class ModbusTCPController implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { + nettyServer = new NettyServer(502, Math.max(20, Runtime.getRuntime().availableProcessors() - 1)); nettyServer.start(); }