YoWuwuuuw commented on code in PR #7345:
URL: https://github.com/apache/incubator-seata/pull/7345#discussion_r2097487243


##########
discovery/seata-discovery-core/src/main/java/org/apache/seata/discovery/registry/MultiRegistryFactory.java:
##########
@@ -48,26 +49,36 @@ public static List<RegistryService> getInstances() {
 
     private static List<RegistryService> buildRegistryServices() {
         List<RegistryService> registryServices = new ArrayList<>();
-        String registryTypeNamesStr =
-            
ConfigurationFactory.CURRENT_FILE_INSTANCE.getConfig(ConfigurationKeys.FILE_ROOT_REGISTRY
-                + ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR + 
ConfigurationKeys.FILE_ROOT_TYPE);
+        Set<String> processedRegistryTypes = new HashSet<>();
+        String registryTypeNamesStr = 
ConfigurationFactory.CURRENT_FILE_INSTANCE.getConfig(
+                ConfigurationKeys.FILE_ROOT_REGISTRY + 
ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR + ConfigurationKeys.FILE_ROOT_TYPE);
+
         if (StringUtils.isBlank(registryTypeNamesStr)) {
             registryTypeNamesStr = RegistryType.File.name();
         }
         String[] registryTypeNames = 
registryTypeNamesStr.split(Constants.REGISTRY_TYPE_SPLIT_CHAR);
+
         if (registryTypeNames.length > 1) {
             LOGGER.info("use multi registry center type: {}", 
registryTypeNamesStr);
         }
+
         for (String registryTypeName : registryTypeNames) {
             RegistryType registryType;
             try {
                 registryType = RegistryType.getType(registryTypeName);
             } catch (Exception exx) {
                 throw new NotSupportYetException("not support registry type: " 
+ registryTypeName);
             }
+
+            if (processedRegistryTypes.contains(registryType.name())) {
+                LOGGER.warn("The duplicate registration center type '{}' was 
found in the configuration and has been skipped.", registryType.name());
+                continue;

Review Comment:
   Ok, learned and used the method you wrote before in #7315 (it's awesome)



-- 
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: notifications-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to