yuqi1129 commented on code in PR #13214:
URL: https://github.com/apache/gravitino/pull/13214#discussion_r4025491427


##########
flink-connector/flink-common/src/main/java/org/apache/gravitino/flink/connector/utils/FactoryUtils.java:
##########
@@ -51,7 +55,33 @@ private FactoryUtils() {}
           GravitinoPaimonCatalogFactoryOptions.IDENTIFIER);
 
   public static boolean isGravitinoManagedCatalogType(String type) {
-    return GRAVITINO_CATALOG_TYPES.contains(type);
+    return GRAVITINO_CATALOG_TYPES.contains(type) || 
isProvidedByCatalogFactory(type);
+  }
+
+  /**
+   * Whether a {@link BaseCatalogFactory} on the classpath declares the type. 
This lets a jar
+   * outside the connector contribute catalog types without registering them 
here.
+   */
+  private static boolean isProvidedByCatalogFactory(String type) {
+    if (type == null) {
+      return false;
+    }
+    Iterator<Factory> iterator = ServiceLoader.load(Factory.class).iterator();
+    while (true) {
+      try {
+        if (!iterator.hasNext()) {

Review Comment:
   Why not write it in the following case
   
   while(iterator.hasNext()) {
      //...
   }



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

Reply via email to