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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]