From cb45d95486f10211336bfc9f881488df388dd239 Mon Sep 17 00:00:00 2001 From: guoshengxiong <1923636941@qq.com> Date: Mon, 7 Apr 2025 17:05:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?netty=E7=BB=91=E5=AE=9A=E7=AB=AF=E5=8F=A3?= =?UTF-8?q?=E6=8A=A5=E9=94=99bug=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tcp/location/server/NettyTcpServer.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/zhgd/netty/tcp/location/server/NettyTcpServer.java b/src/main/java/com/zhgd/netty/tcp/location/server/NettyTcpServer.java index d68c19236..70b220faf 100644 --- a/src/main/java/com/zhgd/netty/tcp/location/server/NettyTcpServer.java +++ b/src/main/java/com/zhgd/netty/tcp/location/server/NettyTcpServer.java @@ -53,17 +53,21 @@ public class NettyTcpServer { */ @PostConstruct public void start() throws InterruptedException { - ServerBootstrap serverBootstrap = new ServerBootstrap(); - serverBootstrap.group(bossGroup, workerGroup) - .channel(NioServerSocketChannel.class) - .childHandler(jt808ChannelInitializer) - .option(ChannelOption.SO_BACKLOG, 1024) //服务端可连接队列数,对应TCP/IP协议listen函数中backlog参数 - .childOption(ChannelOption.TCP_NODELAY, true)//立即写出 - .childOption(ChannelOption.SO_KEEPALIVE, true);//长连接 - ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.SIMPLE);//内存泄漏检测 开发推荐PARANOID 线上SIMPLE - ChannelFuture channelFuture = serverBootstrap.bind(port).sync(); - if (channelFuture.isSuccess()) { - log.info("定位TCP服务启动完毕,port={}", this.port); + try { + ServerBootstrap serverBootstrap = new ServerBootstrap(); + serverBootstrap.group(bossGroup, workerGroup) + .channel(NioServerSocketChannel.class) + .childHandler(jt808ChannelInitializer) + .option(ChannelOption.SO_BACKLOG, 1024) //服务端可连接队列数,对应TCP/IP协议listen函数中backlog参数 + .childOption(ChannelOption.TCP_NODELAY, true)//立即写出 + .childOption(ChannelOption.SO_KEEPALIVE, true);//长连接 + ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.SIMPLE);//内存泄漏检测 开发推荐PARANOID 线上SIMPLE + ChannelFuture channelFuture = serverBootstrap.bind(port).sync(); + if (channelFuture.isSuccess()) { + log.info("定位TCP服务启动完毕,port={}", this.port); + } + } catch (Exception e) { + log.error("定位TCP服务启动异常,port={}", this.port); } } From 629c93584f0670e7de80ae7ddc127826d106e37d Mon Sep 17 00:00:00 2001 From: guoshengxiong <1923636941@qq.com> Date: Mon, 7 Apr 2025 17:05:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=AF=BC=E5=85=A5bug=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WorkerInfoServiceImpl.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java index ce1a60101..e07c84dfb 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java @@ -84,6 +84,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -511,8 +512,13 @@ public class WorkerInfoServiceImpl extends ServiceImpl> list = ExcelUtils.jxlExlToList(is, 0); @@ -1898,6 +1906,7 @@ public class WorkerInfoServiceImpl extends ServiceImpl