mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
fix(nacos): fix issue #859
This commit is contained in:
@@ -182,9 +182,9 @@ public class NacosDiscoveryProperties {
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
private NamingService namingService;
|
||||
private static NamingService NAMING_SERVICE;
|
||||
|
||||
private NamingMaintainService namingMaintainService;
|
||||
private static NamingMaintainService NAMING_MAINTAIN_SERVICE;
|
||||
|
||||
@PostConstruct
|
||||
public void init() throws SocketException {
|
||||
@@ -465,35 +465,35 @@ public class NacosDiscoveryProperties {
|
||||
|
||||
public NamingService namingServiceInstance() {
|
||||
|
||||
if (null != namingService) {
|
||||
return namingService;
|
||||
if (null != NAMING_SERVICE) {
|
||||
return NAMING_SERVICE;
|
||||
}
|
||||
|
||||
try {
|
||||
namingService = NacosFactory.createNamingService(getNacosProperties());
|
||||
NAMING_SERVICE = NacosFactory.createNamingService(getNacosProperties());
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("create naming service error!properties={},e=,", this, e);
|
||||
return null;
|
||||
}
|
||||
return namingService;
|
||||
return NAMING_SERVICE;
|
||||
}
|
||||
|
||||
public NamingMaintainService namingMaintainServiceInstance() {
|
||||
|
||||
if (null != namingMaintainService) {
|
||||
return namingMaintainService;
|
||||
if (null != NAMING_MAINTAIN_SERVICE) {
|
||||
return NAMING_MAINTAIN_SERVICE;
|
||||
}
|
||||
|
||||
try {
|
||||
namingMaintainService = NamingMaintainFactory
|
||||
NAMING_MAINTAIN_SERVICE = NamingMaintainFactory
|
||||
.createMaintainService(getNacosProperties());
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("create naming service error!properties={},e=,", this, e);
|
||||
return null;
|
||||
}
|
||||
return namingMaintainService;
|
||||
return NAMING_MAINTAIN_SERVICE;
|
||||
}
|
||||
|
||||
private Properties getNacosProperties() {
|
||||
|
Reference in New Issue
Block a user