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:
parent
5a9fb3ade1
commit
63e160560c
@ -184,7 +184,7 @@ public class NacosConfigProperties {
|
|||||||
*/
|
*/
|
||||||
private List<Config> extConfig;
|
private List<Config> extConfig;
|
||||||
|
|
||||||
private ConfigService configService;
|
private static ConfigService CONFIG_SERVICE;
|
||||||
|
|
||||||
// todo sts support
|
// todo sts support
|
||||||
|
|
||||||
@ -402,8 +402,8 @@ public class NacosConfigProperties {
|
|||||||
|
|
||||||
public ConfigService configServiceInstance() {
|
public ConfigService configServiceInstance() {
|
||||||
|
|
||||||
if (null != configService) {
|
if (null != CONFIG_SERVICE) {
|
||||||
return configService;
|
return CONFIG_SERVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
@ -430,8 +430,8 @@ public class NacosConfigProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
configService = NacosFactory.createConfigService(properties);
|
CONFIG_SERVICE = NacosFactory.createConfigService(properties);
|
||||||
return configService;
|
return CONFIG_SERVICE;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log.error("create config service error!properties={},e=,", this, e);
|
log.error("create config service error!properties={},e=,", this, e);
|
||||||
|
@ -182,9 +182,9 @@ public class NacosDiscoveryProperties {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Environment environment;
|
private Environment environment;
|
||||||
|
|
||||||
private NamingService namingService;
|
private static NamingService NAMING_SERVICE;
|
||||||
|
|
||||||
private NamingMaintainService namingMaintainService;
|
private static NamingMaintainService NAMING_MAINTAIN_SERVICE;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() throws SocketException {
|
public void init() throws SocketException {
|
||||||
@ -465,35 +465,35 @@ public class NacosDiscoveryProperties {
|
|||||||
|
|
||||||
public NamingService namingServiceInstance() {
|
public NamingService namingServiceInstance() {
|
||||||
|
|
||||||
if (null != namingService) {
|
if (null != NAMING_SERVICE) {
|
||||||
return namingService;
|
return NAMING_SERVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
namingService = NacosFactory.createNamingService(getNacosProperties());
|
NAMING_SERVICE = NacosFactory.createNamingService(getNacosProperties());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log.error("create naming service error!properties={},e=,", this, e);
|
log.error("create naming service error!properties={},e=,", this, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return namingService;
|
return NAMING_SERVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingMaintainService namingMaintainServiceInstance() {
|
public NamingMaintainService namingMaintainServiceInstance() {
|
||||||
|
|
||||||
if (null != namingMaintainService) {
|
if (null != NAMING_MAINTAIN_SERVICE) {
|
||||||
return namingMaintainService;
|
return NAMING_MAINTAIN_SERVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
namingMaintainService = NamingMaintainFactory
|
NAMING_MAINTAIN_SERVICE = NamingMaintainFactory
|
||||||
.createMaintainService(getNacosProperties());
|
.createMaintainService(getNacosProperties());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log.error("create naming service error!properties={},e=,", this, e);
|
log.error("create naming service error!properties={},e=,", this, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return namingMaintainService;
|
return NAMING_MAINTAIN_SERVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Properties getNacosProperties() {
|
private Properties getNacosProperties() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user