3 次代码提交 70353f86a5 ... b899ecd5e0

作者 SHA1 备注 提交日期
  zjs b899ecd5e0 回复消息 bug修改 1 周之前
  zjs c5e61eebbd 延长超时时间 1 周之前
  zjs 972c68e331 接收到数据,做回复 1 周之前

+ 2 - 0
src/main/java/com/cn/esermis/netty/BootNettyChannelInboundHandlerAdapter.java

@@ -80,6 +80,8 @@ public class BootNettyChannelInboundHandlerAdapter extends ChannelInboundHandler
80 80
             if (message.contains(Constant.MINUTE_STR) || message.contains(Constant.HOUR_STR)) {
81 81
                 log.info("=============" + (new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date()) + "=============");
82 82
                 log.info("收到数据:" + message);
83
+                String reply = HJ212MsgUtils.reply(message);
84
+                ctx.writeAndFlush(reply);
83 85
             }
84 86
             if (message.contains("&&")) {
85 87
                 String[] split = message.split("&&");

+ 3 - 3
src/main/java/com/cn/esermis/netty/BootNettyChannelInitializer.java

@@ -14,11 +14,11 @@ import java.util.concurrent.TimeUnit;
14 14
 public class BootNettyChannelInitializer<SocketChannel>extends ChannelInitializer<Channel> {
15 15
 
16 16
     //注意超时时间,这里配置,最好设置长点,要不代码 会自动关连接。这里是60秒
17
-    public static long READ_TIME_OUT = 60;
17
+    public static long READ_TIME_OUT = 60*30;
18 18
 
19
-    public static long WRITE_TIME_OUT = 60;
19
+    public static long WRITE_TIME_OUT = 60*30;
20 20
 
21
-    public static long ALL_TIME_OUT = 60;
21
+    public static long ALL_TIME_OUT = 60*30;
22 22
 
23 23
     @Override
24 24
     protected void initChannel(Channel ch) throws Exception {

+ 4 - 1
src/main/java/com/cn/esermis/server/Consumer.java

@@ -38,7 +38,10 @@ public class Consumer {
38 38
             Object message = redisQueueService.receiveMessage(Constant.SERVER);
39 39
             if (message==null || message.equals("")){
40 40
 //                System.out.println("消息队列为空");
41
-                Thread.sleep(1000*5);
41
+                try {
42
+                    Thread.sleep(1000*5);
43
+                } catch (InterruptedException e) {
44
+                }
42 45
             }else{
43 46
                 tolot++;
44 47
                 int finalTolot = tolot;

文件差异内容过多而无法显示
+ 42 - 3
src/main/java/com/cn/esermis/utils/HJ212MsgUtils.java