zcbbpo commented on pull request #9780:
URL: https://github.com/apache/dubbo/pull/9780#issuecomment-1066636859


   Hi chickenlj
   
   by the way ,The project cannot use stream?
   This code was not approve?
   ```
   public static int getConsumerAddressNum(ConsumerModel consumerModel) {
           // TODO, only check one registry by default.
           int num = 0;
   
           RegistryManager registryManager = 
consumerModel.getModuleModel().getApplicationModel().getBeanFactory().getBean(RegistryManager.class);
           Collection<Registry> registries = registryManager.getRegistries();
           if (CollectionUtils.isEmpty(registries)) {
               return num;
           }
           return registries.stream()
               .filter(v -> v instanceof AbstractRegistry)
               .findFirst()
               .map(v -> (AbstractRegistry)v)
               .flatMap(abstractRegistry -> 
abstractRegistry.getNotified().entrySet().stream()
                   .filter(kv -> 
kv.getKey().getServiceKey().equals(consumerModel.getServiceKey()))
                   .filter(kv -> CollectionUtils.isNotEmptyMap(kv.getValue()))
                   .findFirst()
                   .map(kv -> kv.getValue().size()))
               .orElse(num);
       }
   ```
   


-- 
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