fix(nacos): fix issue #859

pull/909/head
chuntaojun 5 years ago
parent 5a9fb3ade1
commit 63e160560c

@ -184,7 +184,7 @@ public class NacosConfigProperties {
*/
private List<Config> extConfig;
private ConfigService configService;
private static ConfigService CONFIG_SERVICE;
// todo sts support
@ -402,8 +402,8 @@ public class NacosConfigProperties {
public ConfigService configServiceInstance() {
if (null != configService) {
return configService;
if (null != CONFIG_SERVICE) {
return CONFIG_SERVICE;
}
Properties properties = new Properties();
@ -430,8 +430,8 @@ public class NacosConfigProperties {
}
try {
configService = NacosFactory.createConfigService(properties);
return configService;
CONFIG_SERVICE = NacosFactory.createConfigService(properties);
return CONFIG_SERVICE;
}
catch (Exception e) {
log.error("create config service error!properties={},e=,", this, e);

@ -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() {

Loading…
Cancel
Save