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 Jun 13, 2023
1 parent 6328415 commit 87ffa49
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.service.impl.InstanceRegistryCache;
Expand Down Expand Up @@ -203,7 +204,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 87ffa49

Please sign in to comment.