mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
fix(nacos): Repair to create a large number of Nacos*Service problems
This commit is contained in:
@@ -505,6 +505,8 @@ public class DubboServiceDiscoveryAutoConfiguration {
|
||||
|
||||
private final NamingService namingService;
|
||||
|
||||
private final NacosDiscoveryProperties nacosDiscoveryProperties;
|
||||
|
||||
/**
|
||||
* the set of services is listening.
|
||||
*/
|
||||
@@ -512,6 +514,7 @@ public class DubboServiceDiscoveryAutoConfiguration {
|
||||
|
||||
NacosConfiguration(NacosDiscoveryProperties nacosDiscoveryProperties) {
|
||||
this.namingService = nacosDiscoveryProperties.namingServiceInstance();
|
||||
this.nacosDiscoveryProperties = nacosDiscoveryProperties;
|
||||
this.listeningServices = new ConcurrentSkipListSet<>();
|
||||
}
|
||||
|
||||
@@ -536,7 +539,8 @@ public class DubboServiceDiscoveryAutoConfiguration {
|
||||
private void subscribeEventListener(String serviceName) {
|
||||
if (listeningServices.add(serviceName)) {
|
||||
try {
|
||||
namingService.subscribe(serviceName, event -> {
|
||||
String group = nacosDiscoveryProperties.getGroup();
|
||||
namingService.subscribe(serviceName, group, event -> {
|
||||
if (event instanceof NamingEvent) {
|
||||
NamingEvent namingEvent = (NamingEvent) event;
|
||||
List<ServiceInstance> serviceInstances = hostToServiceInstanceList(
|
||||
|
@@ -390,11 +390,9 @@ public class DubboServiceMetadataRepository
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
return hasText(protocol)
|
||||
? urls.stream()
|
||||
.filter(url -> url.getProtocol().equalsIgnoreCase(protocol))
|
||||
.collect(Collectors.toList())
|
||||
: unmodifiableList(urls);
|
||||
return hasText(protocol) ? urls.stream()
|
||||
.filter(url -> url.getProtocol().equalsIgnoreCase(protocol))
|
||||
.collect(Collectors.toList()) : unmodifiableList(urls);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -19,7 +19,7 @@ package com.alibaba.cloud.dubbo.autoconfigure;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
* {@link DubboServiceRegistrationAutoConfiguration} Test
|
||||
* {@link DubboServiceRegistrationAutoConfiguration} Test.
|
||||
*
|
||||
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
|
||||
*/
|
||||
|
@@ -26,7 +26,7 @@ import org.springframework.core.ResolvableType;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
/**
|
||||
* {@link AbstractMediaTypeExpression} Test
|
||||
* {@link AbstractMediaTypeExpression} Test.
|
||||
*
|
||||
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
|
||||
*/
|
||||
|
Reference in New Issue
Block a user