Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mercyblitz committed Mar 24, 2020
2 parents 4526074 + 3c6a54c commit c369714
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public NacosConfigEndpoint nacosConfigEndpoint() {
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(name = "spring.cloud.nacos.config.health.enabled", matchIfMissing = true)
public NacosConfigHealthIndicator nacosConfigHealthIndicator() {
return new NacosConfigHealthIndicator(nacosConfigManager.getConfigService());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"type": "java.util.List",
"description": "a set of shared configurations .e.g: spring.cloud.nacos.config.shared-configs[0]=xxx ."
},

{
"name": "spring.cloud.nacos.config.refreshable-dataids",
"type": "java.lang.String",
Expand All @@ -56,6 +55,12 @@
"type": "java.util.List",
"description": "a set of extensional configurations .e.g: spring.cloud.nacos.config.extension-configs[0]=xxx ."
},
{
"name": "spring.cloud.nacos.config.health.enabled",
"type": "java.lang.Boolean",
"defaultValue": true,
"description": "the switch for health check, it default enabled(true)."
},
{
"name": "spring.cloud.nacos.config.refresh-enabled",
"type": "java.lang.Boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,15 @@ protected void subscribeDubboServiceURL(URL url, NotifyListener listener,
Collection<ServiceInstance> serviceInstances = serviceInstancesFunction
.apply(serviceName);

// issue : ReStarting a consumer and then starting a provider does not automatically discover the registration
// fix https://github.com/alibaba/spring-cloud-alibaba/issues/753
// Re-obtain the latest list of available metadata address here, ip or port may change.
// by https://github.com/wangzihaogithub
dubboMetadataConfigServiceProxy.removeProxy(serviceName);
repository.removeMetadataAndInitializedService(serviceName);
dubboGenericServiceFactory.destroy(serviceName);
repository.initializeMetadata(serviceName);
if (CollectionUtils.isEmpty(serviceInstances)) {
dubboMetadataConfigServiceProxy.removeProxy(serviceName);
repository.removeMetadataAndInitializedService(serviceName);
dubboGenericServiceFactory.destroy(serviceName);
if (logger.isWarnEnabled()) {
logger.warn(
"There is no instance from service[name : {}], and then Dubbo Service[key : {}] will not be "
Expand All @@ -246,18 +251,6 @@ protected void subscribeDubboServiceURL(URL url, NotifyListener listener,

DubboMetadataService dubboMetadataService = dubboMetadataConfigServiceProxy
.getProxy(serviceName);

if (dubboMetadataService == null) { // If not found, try to initialize
if (logger.isInfoEnabled()) {
logger.info(
"The metadata of Dubbo service[key : {}] can't be found when the subscribed service[name : {}], "
+ "and then try to initialize it",
url.getServiceKey(), serviceName);
}
repository.initializeMetadata(serviceName);
dubboMetadataService = dubboMetadataConfigServiceProxy.getProxy(serviceName);
}

if (dubboMetadataService == null) { // It makes sure not-found, return immediately
if (logger.isWarnEnabled()) {
logger.warn(
Expand All @@ -269,7 +262,6 @@ protected void subscribeDubboServiceURL(URL url, NotifyListener listener,
}

List<URL> exportedURLs = getExportedURLs(dubboMetadataService, url);

for (URL exportedURL : exportedURLs) {
String protocol = exportedURL.getProtocol();
List<URL> subscribedURLs = new LinkedList<>();
Expand Down

0 comments on commit c369714

Please sign in to comment.