mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
remove duplicate and put once in datasource registry.
This commit is contained in:
parent
ed7fb738f0
commit
8190b0f4a1
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.alibaba.sentinel.datasource;
|
package org.springframework.cloud.alibaba.sentinel.datasource;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import com.alibaba.csp.sentinel.datasource.ReadableDataSource;
|
import com.alibaba.csp.sentinel.datasource.ReadableDataSource;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.Zookeep
|
|||||||
*/
|
*/
|
||||||
public class SentinelDataSourceRegistry {
|
public class SentinelDataSourceRegistry {
|
||||||
|
|
||||||
private static ConcurrentHashMap<String, Class<? extends FactoryBean>> cache = new ConcurrentHashMap<>(
|
private static HashMap<String, Class<? extends FactoryBean>> cache = new HashMap<>(
|
||||||
32);
|
32);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -54,7 +54,6 @@ public class SentinelDataSourceRegistry {
|
|||||||
|
|
||||||
public static synchronized void registerFactoryBean(String alias,
|
public static synchronized void registerFactoryBean(String alias,
|
||||||
Class<? extends FactoryBean> clazz) {
|
Class<? extends FactoryBean> clazz) {
|
||||||
cache.putIfAbsent(alias, clazz);
|
|
||||||
cache.put(alias, clazz);
|
cache.put(alias, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user