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 6a24147731 [ISSUE #8671] Replace channel.attr() set() and get() with 
RemotingHelper
6a24147731 is described below

commit 6a241477310acd2a14d352215aad01fe9eb2f81b
Author: qianye <[email protected]>
AuthorDate: Thu Sep 19 17:27:49 2024 +0800

    [ISSUE #8671] Replace channel.attr() set() and get() with RemotingHelper
---
 .../apache/rocketmq/remoting/netty/NettyRemotingServer.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
 
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
index 51f8b85009..8a329a37ac 100644
--- 
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
+++ 
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
@@ -782,16 +782,16 @@ public class NettyRemotingServer extends 
NettyRemotingAbstract implements Remoti
         private void handleWithMessage(HAProxyMessage msg, Channel channel) {
             try {
                 if (StringUtils.isNotBlank(msg.sourceAddress())) {
-                    
channel.attr(AttributeKeys.PROXY_PROTOCOL_ADDR).set(msg.sourceAddress());
+                    RemotingHelper.setPropertyToAttr(channel, 
AttributeKeys.PROXY_PROTOCOL_ADDR, msg.sourceAddress());
                 }
                 if (msg.sourcePort() > 0) {
-                    
channel.attr(AttributeKeys.PROXY_PROTOCOL_PORT).set(String.valueOf(msg.sourcePort()));
+                    RemotingHelper.setPropertyToAttr(channel, 
AttributeKeys.PROXY_PROTOCOL_PORT, String.valueOf(msg.sourcePort()));
                 }
                 if (StringUtils.isNotBlank(msg.destinationAddress())) {
-                    
channel.attr(AttributeKeys.PROXY_PROTOCOL_SERVER_ADDR).set(msg.destinationAddress());
+                    RemotingHelper.setPropertyToAttr(channel, 
AttributeKeys.PROXY_PROTOCOL_SERVER_ADDR, msg.destinationAddress());
                 }
                 if (msg.destinationPort() > 0) {
-                    
channel.attr(AttributeKeys.PROXY_PROTOCOL_SERVER_PORT).set(String.valueOf(msg.destinationPort()));
+                    RemotingHelper.setPropertyToAttr(channel, 
AttributeKeys.PROXY_PROTOCOL_SERVER_PORT, 
String.valueOf(msg.destinationPort()));
                 }
                 if (CollectionUtils.isNotEmpty(msg.tlvs())) {
                     msg.tlvs().forEach(tlv -> {
@@ -811,6 +811,6 @@ public class NettyRemotingServer extends 
NettyRemotingAbstract implements Remoti
         }
         AttributeKey<String> key = AttributeKeys.valueOf(
             HAProxyConstants.PROXY_PROTOCOL_TLV_PREFIX + String.format("%02x", 
tlv.typeByteValue()));
-        channel.attr(key).set(new String(valueBytes, CharsetUtil.UTF_8));
+        RemotingHelper.setPropertyToAttr(channel, key, new String(valueBytes, 
CharsetUtil.UTF_8));
     }
 }

Reply via email to