Skip to content

Commit

Permalink
Optimize REGISTRIES field in AbstractRegistryFactory. (apache#2703)
Browse files Browse the repository at this point in the history
* modify ConcurrentHashMap to HashMap.这里REGISTRIES在使用的时候都会先加锁,不存在多线程安全的问题。所以这里建议使用hashmap

* modify ConcurrentHashMap to HashMap.这里REGISTRIES在使用的时候都会先加锁,不存在多线程安全的问题。所以这里建议使用hashmap
  • Loading branch information
jingui123 authored and CrazyHZM committed Dec 6, 2018
1 parent c131026 commit 9d2a896
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

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;

/**
Expand All @@ -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
Expand Down

0 comments on commit 9d2a896

Please sign in to comment.