소스 검색

修改成8个字节长度频繁报错,改回4个字节

lgy 3 년 전
부모
커밋
1b0a97186c
2개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 2
      src/main/java/com/persagy/client/GroupNettyClient.java
  2. 2 2
      src/main/resources/application.yml

+ 2 - 2
src/main/java/com/persagy/client/GroupNettyClient.java

@@ -79,10 +79,10 @@ public class GroupNettyClient {
                     .handler(new ChannelInitializer<SocketChannel>() {
                         @Override
                         protected void initChannel(SocketChannel ch) throws Exception {
-                            ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 8, 0, 8));
-                            ch.pipeline().addLast(new LengthFieldPrepender(8));
+                            ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4));
                             // 将分隔之后的字节数据转换为字符串
                             ch.pipeline().addLast(new StringDecoder());
+                            ch.pipeline().addLast(new LengthFieldPrepender(4));
                             ch.pipeline().addLast(new StringEncoder());
                             // pipeline可以理解为所有handler的初始化容器
                             ch.pipeline().addLast(new GroupNettyClientHandler(groupNettyClient, alarmDefineService, alarmRecordRepository));// 添加自定义handler

+ 2 - 2
src/main/resources/application.yml

@@ -6,10 +6,10 @@ spring:
   application:
     name: zkt-project-alarm
   profiles:
-    active: 39Pj5001120003 #Pj4403070003
+    active: Pj4403070003 #39Pj5001120003 #Pj4403070003
   datasource:
     #需要更改
-    url: jdbc:mysql://39.102.43.179:9934/alarm-quartz-xg?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false
+    url: jdbc:mysql://39.102.43.179:9934/alarm-quartz-wd?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false
     driver-class-name: com.mysql.jdbc.Driver  # mysql8.0以前使用com.mysql.jdbc.Driver
     #需要更改
     username: root