You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by il...@apache.org on 2018/10/30 02:24:53 UTC

[incubator-dubbo] branch master updated: Optimize REGISTRIES field in AbstractRegistryFactory. (#2703)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 99a00ba  Optimize REGISTRIES field in AbstractRegistryFactory. (#2703)
99a00ba is described below

commit 99a00ba72b53d6f740899ddb76c858b8f99683ac
Author: jingui123 <58...@qq.com>
AuthorDate: Tue Oct 30 10:24:45 2018 +0800

    Optimize REGISTRIES field in AbstractRegistryFactory. (#2703)
    
    * modify ConcurrentHashMap to HashMap.这里REGISTRIES在使用的时候都会先加锁,不存在多线程安全的问题。所以这里建议使用hashmap
    
    * modify ConcurrentHashMap to HashMap.这里REGISTRIES在使用的时候都会先加锁,不存在多线程安全的问题。所以这里建议使用hashmap
---
 .../org/apache/dubbo/registry/support/AbstractRegistryFactory.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java
index 8347d9a..64647f4 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java
@@ -26,8 +26,8 @@ import org.apache.dubbo.registry.RegistryService;
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.ReentrantLock;
 
 /**
@@ -44,7 +44,7 @@ public abstract class AbstractRegistryFactory implements RegistryFactory {
     private static final ReentrantLock LOCK = new ReentrantLock();
 
     // Registry Collection Map<RegistryAddress, Registry>
-    private static final Map<String, Registry> REGISTRIES = new ConcurrentHashMap<String, Registry>();
+    private static final Map<String, Registry> REGISTRIES = new HashMap<>();
 
     /**
      * Get all registries