Copilot commented on code in PR #10763:
URL: https://github.com/apache/rocketmq/pull/10763#discussion_r3701489629
##########
proxy/src/main/java/org/apache/rocketmq/proxy/processor/channel/RemoteChannel.java:
##########
@@ -110,7 +110,8 @@ public String toString() {
.add("channelId", id())
.add("type", type)
.add("remoteProxyIp", remoteProxyIp)
- .add("extendAttribute", extendAttribute)
+ .add("extendAttributePresent", extendAttribute != null)
+ .add("extendAttributeLength", extendAttribute == null ? 0 :
extendAttribute.length())
Review Comment:
`extendAttribute` is declared `volatile`, but `toString()` reads it twice
(for present + length). If another thread updates the value between reads, the
output can become internally inconsistent (e.g., present=false but length>0).
Capture a local snapshot once and use it for both fields.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]