shihaojun opened a new issue, #10659:
URL: https://github.com/apache/dubbo/issues/10659

   version:3.1.0
   on 
org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener#getServiceUrlsCache
   
               for (ServiceInstance i : revisionToInstances.get(r)) {
                   if (port > 0) {
                       if (i.getPort() == port) {
                           
urls.add(i.toURL(protocol).setScopeModel(i.getApplicationModel()));
                       } else {
                           urls.add(((DefaultServiceInstance) 
i).copyFrom(port).toURL(protocol).setScopeModel(i.getApplicationModel()));
                       }
                       continue;
                   }
   this code change another provider's port, so this two url has the same 
ip:port
   It's a bug or I use dubbo on the wrong way?
   By the way It would't happen on version 2.7.5
   
   provider like this:
   _public static <T, P extends T> void export(Class<T> interfaceClass, P 
implClass, int port) {
           ServiceConfig<T> serviceConfig = new ServiceConfig<>();
           serviceConfig.setInterface(interfaceClass);
           serviceConfig.setRef(implClass);
           serviceConfig.setProtocol(new ProtocolConfig("dubbo", port));
           DubboBootstrap.getInstance().service(serviceConfig);
           DubboBootstrap.getInstance().start().await();
       }_
   
   consumer like this:
   public static <T> T refer(Class<T> interfaceClass) {
           ReferenceConfig<T> referenceConfig = new ReferenceConfig<>();
           referenceConfig.setInterface(interfaceClass);
           referenceConfig.setCheck(false);
           referenceConfig.setLazy(true);
           referenceConfig.setSticky(false);
           referenceConfig.setLoadbalance(router);
           referenceConfig.setRouter(router);
           return referenceConfig.get();
       }
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to