From 2228c73293e419ed249a27c426c0d08ce95d517e Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期五, 14 三月 2025 15:55:13 +0800
Subject: [PATCH] 配置信息
---
src/main/java/com/zy/core/netty/handle/PackageServerHandler.java | 31 +++++++++++++------------------
1 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/src/main/java/com/zy/core/netty/handle/PackageServerHandler.java b/src/main/java/com/zy/core/netty/handle/PackageServerHandler.java
index fc7f7a5..a134908 100644
--- a/src/main/java/com/zy/core/netty/handle/PackageServerHandler.java
+++ b/src/main/java/com/zy/core/netty/handle/PackageServerHandler.java
@@ -1,15 +1,10 @@
package com.zy.core.netty.handle;
-import com.core.common.Cools;
-import com.zy.core.Slave;
-import com.zy.core.cache.SlaveConnection;
-import com.zy.core.enums.SlaveType;
import com.zy.core.netty.AbstractInboundHandler;
import com.zy.core.netty.cache.ChannelCache;
import com.zy.core.netty.domain.ChPackage;
import com.zy.core.netty.properties.TcpProperties;
import com.zy.core.properties.SlaveProperties;
-import com.zy.core.thread.BarcodeThread;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
@@ -31,6 +26,19 @@
@Autowired
private TcpProperties tcpProperties;
+ /**
+ * 鏁版嵁涓嬭
+ */
+ public static void write(ChPackage chPackage) {
+ String uuid = chPackage.getUuid();
+ Channel channel = ChannelCache.getChannel(uuid);
+ if (null == channel) {
+ log.warn("閫氶亾uuid={} 涓嶅湪绾�", uuid);
+ return;
+ }
+ channel.writeAndFlush(chPackage);
+ }
+
@Override
protected boolean channelRead0(ChannelHandlerContext ctx, ChPackage pac) {
// log.info("璇荤爜鍣ㄣ�怚P:{}銆� 涓婅鏁版嵁 ===>> {}", pac.getIp(), pac.getAscii());
@@ -50,18 +58,5 @@
// }
return true;
- }
-
- /**
- * 鏁版嵁涓嬭
- */
- public static void write(ChPackage chPackage){
- String uuid = chPackage.getUuid();
- Channel channel = ChannelCache.getChannel(uuid);
- if (null == channel){
- log.warn("閫氶亾uuid={} 涓嶅湪绾�", uuid);
- return;
- }
- channel.writeAndFlush(chPackage);
}
}
--
Gitblit v1.9.1