1、增加log查问题

This commit is contained in:
weidong 2025-07-20 21:26:41 +08:00
parent cc5f3d0772
commit e286c355ff
2 changed files with 7 additions and 6 deletions

View File

@ -92,6 +92,7 @@ public class TCPClient {
public void writeAndFlush(String json) { public void writeAndFlush(String json) {
ByteBuf sendBuffer = Unpooled.buffer(); ByteBuf sendBuffer = Unpooled.buffer();
sendBuffer.writeBytes(json.getBytes(StandardCharsets.UTF_8)); sendBuffer.writeBytes(json.getBytes(StandardCharsets.UTF_8));
logger.info("send to {}: {}",host,json);
channel.writeAndFlush(sendBuffer).addListener(future -> { channel.writeAndFlush(sendBuffer).addListener(future -> {
if (future.isSuccess()) { if (future.isSuccess()) {
logger.info("send to tcp:"+host+" succeed."); logger.info("send to tcp:"+host+" succeed.");

View File

@ -73,8 +73,8 @@ public class GXXfzForwarder extends Forwarder{
if(batchNum==50){ if(batchNum==50){
String json = "#" + GsonUtil.toJson(xfzTcpMessage) + "!"; String json = "#" + GsonUtil.toJson(xfzTcpMessage) + "!";
logger.debug("project {}: forwad {} gnss records to {}",projectId, dataList.size(),fwdGroupId); //logger.debug("project {}: forwad {} gnss records to {}",projectId, dataList.size(),fwdGroupId);
logger.debug(json); //logger.debug(json);
try { try {
listener.clear(); listener.clear();
xfzTcpClient.writeAndFlush(json); xfzTcpClient.writeAndFlush(json);
@ -91,8 +91,8 @@ public class GXXfzForwarder extends Forwarder{
if(batchNum>0){ if(batchNum>0){
String json = "#" + GsonUtil.toJson(xfzTcpMessage) + "!"; String json = "#" + GsonUtil.toJson(xfzTcpMessage) + "!";
logger.debug("project {}: forwad {} gnss records to {}",projectId, dataList.size(),fwdGroupId); //logger.debug("project {}: forwad {} gnss records to {}",projectId, dataList.size(),fwdGroupId);
logger.debug(json); //logger.debug(json);
try { try {
listener.clear(); listener.clear();
xfzTcpClient.writeAndFlush(json); xfzTcpClient.writeAndFlush(json);
@ -107,8 +107,8 @@ public class GXXfzForwarder extends Forwarder{
} }
boolean checkResult() throws InterruptedException { boolean checkResult() throws InterruptedException {
// 等待应答最多等1s // 等待应答最多等500ms
for(int i=0; i<20; i++){ for(int i=0; i<10; i++){
Thread.sleep(50); Thread.sleep(50);
if(listener.state == XFZTCPListener.STATE_OK) return true; if(listener.state == XFZTCPListener.STATE_OK) return true;
else if(listener.state == XFZTCPListener.STATE_FAILED) return false; else if(listener.state == XFZTCPListener.STATE_FAILED) return false;