From 4c4f61d4964bff0e83137c38a7783f9320f250a6 Mon Sep 17 00:00:00 2001 From: weitang Date: Wed, 23 Apr 2025 14:13:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9UDP=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E6=A8=A1=E5=9D=97=E4=BD=BF=E7=94=A8=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E6=B1=A0=E6=96=B9=E5=BC=8F=E5=BC=80=E5=90=AF=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/nettyudpserver/NettyUdpRunner.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/riis-system/src/main/java/com/yfd/platform/component/nettyudpserver/NettyUdpRunner.java b/riis-system/src/main/java/com/yfd/platform/component/nettyudpserver/NettyUdpRunner.java index 31c86fc..b8fde1e 100644 --- a/riis-system/src/main/java/com/yfd/platform/component/nettyudpserver/NettyUdpRunner.java +++ b/riis-system/src/main/java/com/yfd/platform/component/nettyudpserver/NettyUdpRunner.java @@ -1,6 +1,8 @@ package com.yfd.platform.component.nettyudpserver; +import com.yfd.platform.component.nettyserver.NettyServer; +import com.yfd.platform.utils.ExecutionJob; import io.netty.channel.Channel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -15,8 +17,8 @@ public class NettyUdpRunner implements CommandLineRunner { @Override public void run(String... args) throws Exception { - - new Thread(() -> { + + ExecutionJob.EXECUTOR.submit(() -> { NettyUdpServer server = null; try { server = new NettyUdpServer(9300); @@ -24,14 +26,14 @@ public class NettyUdpRunner implements CommandLineRunner { logger.info("NettyUdpRunner running"); channel.closeFuture().sync(); } catch (Exception e) { - logger.error(e.getMessage());; + logger.error(e.getMessage()); + ; } finally { - if(server!=null){ + if (server != null) { server.stop(); } } - } - ).start(); + }); }