You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/04/21 11:43:38 UTC

[dubbo] branch master updated: Optimize code to remove useless objects (#7582)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new d625208  Optimize code to remove useless objects (#7582)
d625208 is described below

commit d6252081e4df078c6cb5d455c6405942fb850670
Author: srchen1987 <su...@163.com>
AuthorDate: Wed Apr 21 19:43:29 2021 +0800

    Optimize code to remove useless objects (#7582)
---
 .../src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java         | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java
index 514dc97..f127f7c 100644
--- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java
+++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java
@@ -160,15 +160,16 @@ public class RpcInvocation implements Invocation, Serializable {
             attachments.put(key, value);
         }
     }
-
+  
     public void addAttachments(Map<String, String> attachments) {
         if (attachments == null) {
             return;
         }
         if (this.attachments == null) {
-            this.attachments = new HashMap<String, String>();
+            this.attachments = attachments;
+        }else{
+            this.attachments.putAll(attachments);
         }
-        this.attachments.putAll(attachments);
     }
 
     public void addAttachmentsIfAbsent(Map<String, String> attachments) {