You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2019/12/17 02:01:21 UTC

[dubbo] branch 2.7.5-release updated: fix potential performance drop of URL operations introduced in #4310 (#5491)

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

liujun pushed a commit to branch 2.7.5-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/2.7.5-release by this push:
     new c5ea738  fix potential performance drop of URL operations introduced in #4310 (#5491)
c5ea738 is described below

commit c5ea7381210e4afbcdcd5057efa9995ee2cc9943
Author: ken.lj <ke...@gmail.com>
AuthorDate: Tue Dec 17 10:01:13 2019 +0800

    fix potential performance drop of URL operations introduced in #4310 (#5491)
---
 dubbo-common/src/main/java/org/apache/dubbo/common/URL.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java b/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
index 5c29cda..96fc6de 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
@@ -577,7 +577,10 @@ class URL implements Serializable {
 
     private Map<String, Number> getNumbers() {
         // concurrent initialization is tolerant
-        return numbers == null ? new ConcurrentHashMap<>() : numbers;
+        if (numbers == null) {
+            numbers = new ConcurrentHashMap<>();
+        }
+        return numbers;
     }
 
     private Map<String, Map<String, Number>> getMethodNumbers() {
@@ -589,7 +592,10 @@ class URL implements Serializable {
 
     private Map<String, URL> getUrls() {
         // concurrent initialization is tolerant
-        return urls == null ? new ConcurrentHashMap<>() : urls;
+        if (urls == null) {
+            urls = new ConcurrentHashMap<>();
+        }
+        return urls;
     }
 
     public URL getUrlParameter(String key) {