Skip to content

Commit

Permalink
fix:Fix init of ServiceMapping when metadata center uses nacos.
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwen5 committed May 30, 2023
1 parent 2b89077 commit f38cd84
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.dubbo.admin.registry.config.GovernanceConfiguration;
import org.apache.dubbo.admin.registry.mapping.AdminMappingListener;
import org.apache.dubbo.admin.registry.mapping.ServiceMapping;
import org.apache.dubbo.admin.registry.mapping.impl.NacosServiceMapping;
import org.apache.dubbo.admin.registry.mapping.impl.NoOpServiceMapping;
import org.apache.dubbo.admin.registry.metadata.MetaDataCollector;
import org.apache.dubbo.admin.registry.metadata.impl.NoOpMetadataCollector;
Expand Down Expand Up @@ -204,7 +205,11 @@ ServiceMapping getServiceMapping(ServiceDiscovery serviceDiscovery, InstanceRegi
MappingListener mappingListener = new AdminMappingListener(serviceDiscovery, instanceRegistryCache);
serviceMapping = ExtensionLoader.getExtensionLoader(ServiceMapping.class).getExtension(metadataUrl.getProtocol());
serviceMapping.addMappingListener(mappingListener);
serviceMapping.init(metadataUrl);
if (serviceMapping instanceof NacosServiceMapping) {
serviceMapping.init(registryUrl);
} else {
serviceMapping.init(metadataUrl);
}
return serviceMapping;
}

Expand Down

0 comments on commit f38cd84

Please sign in to comment.