From adf14794c93fa9358cc2e65659df9b447b2f98a6 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Fri, 15 Dec 2023 16:21:20 +0800 Subject: [PATCH] update --- .../impl/YKCPushCommandServiceImpl.java | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/YKCPushCommandServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/YKCPushCommandServiceImpl.java index 3c5cc3744..a7fd44283 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/YKCPushCommandServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/YKCPushCommandServiceImpl.java @@ -104,19 +104,16 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService { log.info("[" + channel.remoteAddress() + "] 主动发送push请求信息:{}", wholeMsg); ByteBuf byteBuf = channel.alloc().buffer().writeBytes(writeMsg); ChannelFuture channelFuture = channel.writeAndFlush(byteBuf); - channelFuture.addListener(new ChannelFutureListener() { - @Override - public void operationComplete(ChannelFuture channelFuture) throws Exception { - // 检查操作的状态 - if (channelFuture.isSuccess()) { - log.info("push结果【成功】, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}, ", channel.remoteAddress(), channel.id(), value, wholeMsg); - } else { - // 如果发生错误,则访问描述原因的Throwable - Throwable cause = channelFuture.cause(); - // cause.printStackTrace(); - log.info("push结果【失败】, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}", channel.remoteAddress(), channel.id(), value, wholeMsg); - log.error("push发送命令失败", cause); - } + channelFuture.addListener((ChannelFutureListener) channelFutureListener -> { + // 检查操作的状态 + if (channelFutureListener.isSuccess()) { + log.info("push结果【成功】, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}, ", channel.remoteAddress(), channel.id(), value, wholeMsg); + } else { + // 如果发生错误,则访问描述原因的Throwable + Throwable cause = channelFutureListener.cause(); + // cause.printStackTrace(); + log.info("push结果【失败】, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}", channel.remoteAddress(), channel.id(), value, wholeMsg); + log.error("push发送命令失败", cause); } });