This is an automated email from the ASF dual-hosted git repository. jianbin pushed a commit to branch 2.x in repository https://gitbox.apache.org/repos/asf/incubator-seata.git
The following commit(s) were added to refs/heads/2.x by this push: new c67a102456 optimize: send async response (#6534) c67a102456 is described below commit c67a102456f906400b60a315259fa2d5889fbc08 Author: Yeoncheol Jang <65603611+yeoncheol...@users.noreply.github.com> AuthorDate: Thu Jun 20 17:09:25 2024 +0900 optimize: send async response (#6534) --- changes/en-us/2.x.md | 1 + changes/zh-cn/2.x.md | 1 + .../core/rpc/netty/AbstractNettyRemotingServer.java | 18 +++++++++--------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md index 5bdf3d12e7..03ca3d983a 100644 --- a/changes/en-us/2.x.md +++ b/changes/en-us/2.x.md @@ -137,6 +137,7 @@ Add changes here for all PR submitted to the 2.x branch. - [[#6458](https://github.com/apache/incubator-seata/pull/6458)] add null value check for MAC address - [[#6516](https://github.com/apache/incubator-seata/pull/6516)] optimize code format - [[#6529](https://github.com/apache/incubator-seata/pull/6529)] optimize release maven plugin +- [[#6534](https://github.com/apache/incubator-seata/pull/6534)] optimize: send async response - [[#6548](https://github.com/apache/incubator-seata/pull/6548)] upgrade the byte-buddy version to 1.14.15 - [[#6539](https://github.com/apache/incubator-seata/pull/6539)] add subcomponents license - [[#6540](https://github.com/apache/incubator-seata/pull/6540)] exclude com.google.guava:listenablefuture diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md index 3160cb2c28..e3bc069f8b 100644 --- a/changes/zh-cn/2.x.md +++ b/changes/zh-cn/2.x.md @@ -136,6 +136,7 @@ - [[#6412](https://github.com/apache/incubator-seata/pull/6412)] 优化 core 兼容模块 - [[#6518](https://github.com/apache/incubator-seata/pull/6518)] 优化 ConfigurationCache 代理方法 - [[#6529](https://github.com/apache/incubator-seata/pull/6529)] 优化发布插件 +- [[#6534](https://github.com/apache/incubator-seata/pull/6534)] 优化: 发送异步响应 - [[#6548](https://github.com/apache/incubator-seata/pull/6548)] 升级byte-buddy版本至1.14.15 - [[#6539](https://github.com/apache/incubator-seata/pull/6539)] 增加组件 license - [[#6540](https://github.com/apache/incubator-seata/pull/6540)] 排除 com.google.guava:listenablefuture 依赖 diff --git a/core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingServer.java b/core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingServer.java index 16758d5ad1..09696286a6 100644 --- a/core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingServer.java +++ b/core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingServer.java @@ -93,18 +93,18 @@ public abstract class AbstractNettyRemotingServer extends AbstractNettyRemoting @Override public void sendAsyncResponse(RpcMessage rpcMessage, Channel channel, Object msg) { - Channel clientChannel = channel; - if (!(msg instanceof HeartbeatMessage)) { - clientChannel = ChannelManager.getSameClientChannel(channel); + final Channel clientChannel = msg instanceof HeartbeatMessage + ? channel + : ChannelManager.getSameClientChannel(channel); + + if (clientChannel == null) { + throw new RuntimeException("Not found client channel to response | channel: " + channel); } - if (clientChannel != null) { - RpcMessage rpcMsg = buildResponseMessage(rpcMessage, msg, msg instanceof HeartbeatMessage + + RpcMessage rpcMsg = buildResponseMessage(rpcMessage, msg, msg instanceof HeartbeatMessage ? ProtocolConstants.MSGTYPE_HEARTBEAT_RESPONSE : ProtocolConstants.MSGTYPE_RESPONSE); - super.sendAsync(clientChannel, rpcMsg); - } else { - throw new RuntimeException("channel is error."); - } + super.sendAsync(clientChannel, rpcMsg); } @Override --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org