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/16 09:22:18 UTC
[dubbo] 01/01: fix potential performance drop of URL operations
introduced in #4310
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch fix-url-4301
in repository https://gitbox.apache.org/repos/asf/dubbo.git
commit b64bb9bef11f1b7830f3b52386bd4487e573b2db
Author: ken.lj <ke...@gmail.com>
AuthorDate: Mon Dec 16 17:22:02 2019 +0800
fix potential performance drop of URL operations introduced in #4310
---
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) {