You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/06/13 02:43:03 UTC

[GitHub] [dubbo] chickenlj commented on a diff in pull request #10139: [3.0] fix #10078, Use synchronizedMap to avoid ConcurrentModificationException

chickenlj commented on code in PR #10139:
URL: https://github.com/apache/dubbo/pull/10139#discussion_r895287284


##########
dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java:
##########
@@ -397,7 +397,7 @@ public Map<String, String> getAttachments() {
 
     @Deprecated
     public void setAttachments(Map<String, String> attachments) {
-        this.attachments = attachments == null ? new HashMap<>() : new HashMap<>(attachments);

Review Comment:
   'attachments' passed to setAttachments might haven't been synchronized, so it is a requirement of the setter to do that.
   
   But I think it's ok to wrap the newly created map as synchronized.



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org