You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "wang-jiahua (via GitHub)" <gi...@apache.org> on 2026/06/10 14:23:06 UTC
Re: [PR] [ISSUE #10442] Optimize message properties encode/decode to reduce allocation [rocketmq]
wang-jiahua commented on code in PR #10444:
URL: https://github.com/apache/rocketmq/pull/10444#discussion_r3389093743
##########
common/src/main/java/org/apache/rocketmq/common/message/Message.java:
##########
@@ -103,10 +103,12 @@ public String getUserProperty(final String name) {
}
public String getProperty(final String name) {
+ // Read-only access shouldn't allocate. Original side-effect of creating an
+ // empty map on every get is wasted when the message has no properties yet
+ // (e.g. freshly constructed produce request before tags/keys are set).
if (null == this.properties) {
- this.properties = new HashMap<>();
+ return null;
Review Comment:
This change has been split out into a separate PR #10468 and is no longer part of this PR. The discussion about `getProperty` side-effect compatibility and write-path safety will continue there.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org