This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new af900e9416 [ISSUE #7868] Use entrySet to close channel
af900e9416 is described below
commit af900e9416fffa8bbc2eb106c3457cfe5f0cc1b3
Author: ChineseTony <[email protected]>
AuthorDate: Thu Feb 29 10:47:25 2024 +0800
[ISSUE #7868] Use entrySet to close channel
---
.../org/apache/rocketmq/remoting/netty/NettyRemotingClient.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
index 836910f8fa..ede6005f54 100644
---
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
+++
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
@@ -362,8 +362,8 @@ public class NettyRemotingClient extends
NettyRemotingAbstract implements Remoti
try {
this.timer.stop();
- for (String addr : this.channelTables.keySet()) {
- this.channelTables.get(addr).close();
+ for (Map.Entry<String, ChannelWrapper> channel :
this.channelTables.entrySet()) {
+ channel.getValue().close();
}
this.channelWrapperTables.clear();
@@ -943,8 +943,9 @@ public class NettyRemotingClient extends
NettyRemotingAbstract implements Remoti
return;
}
- for (String addr : this.channelTables.keySet()) {
- ChannelWrapper channelWrapper = this.channelTables.get(addr);
+ for (Map.Entry<String, ChannelWrapper> entry :
this.channelTables.entrySet()) {
+ String addr = entry.getKey();
+ ChannelWrapper channelWrapper = entry.getValue();
if (channelWrapper == null) {
continue;
}