mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
optimize code to match p3c check rules
Signed-off-by: jimin.jm <jimin.jm@alibaba-inc.com>
This commit is contained in:
@@ -28,25 +28,25 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class NacosPropertySourceRepository {
|
||||
|
||||
private final static ConcurrentHashMap<String, NacosPropertySource> nacosPropertySourceRepository = new ConcurrentHashMap<>();
|
||||
private final static ConcurrentHashMap<String, NacosPropertySource> NACOS_PROPERTY_SOURCE_REPOSITORY = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* @return all nacos properties from application context
|
||||
*/
|
||||
public static List<NacosPropertySource> getAll() {
|
||||
List<NacosPropertySource> result = new ArrayList<>();
|
||||
result.addAll(nacosPropertySourceRepository.values());
|
||||
result.addAll(NACOS_PROPERTY_SOURCE_REPOSITORY.values());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void collectNacosPropertySources(
|
||||
NacosPropertySource nacosPropertySource) {
|
||||
nacosPropertySourceRepository.putIfAbsent(nacosPropertySource.getDataId(),
|
||||
NACOS_PROPERTY_SOURCE_REPOSITORY.putIfAbsent(nacosPropertySource.getDataId(),
|
||||
nacosPropertySource);
|
||||
}
|
||||
|
||||
public static NacosPropertySource getNacosPropertySource(String dataId) {
|
||||
|
||||
return nacosPropertySourceRepository.get(dataId);
|
||||
return NACOS_PROPERTY_SOURCE_REPOSITORY.get(dataId);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user