leonardBang commented on code in PR #23036:
URL: https://github.com/apache/flink/pull/23036#discussion_r1271454224


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogStoreHolder.java:
##########
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.catalog;
+
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.factories.CatalogStoreFactory;
+
+import javax.annotation.Nullable;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
+/**
+ * A holder for a {@link CatalogStore} instance and the necessary information 
for creating and
+ * initializing {@link Catalog} instances, including a {@link 
CatalogStoreFactory}, a {@link
+ * ReadableConfig} instance, and a {@link ClassLoader} instance. This class 
provides automatic
+ * resource management using the {@link AutoCloseable} interface, ensuring 
that the catalog-related
+ * resources are properly closed and released when they are no longer needed.
+ *
+ * <p>A {@link CatalogStoreFactory} may create multiple {@link CatalogStore} 
instances, which can be
+ * useful in SQL gateway scenarios where different sessions may use different 
catalog stores.
+ * However, in some scenarios, a single {@link CatalogStore} instance may be 
sufficient, in which
+ * case the {@link CatalogStoreFactory} can be stored in the holder to ensure 
that it is properly
+ * closed when the {@link CatalogStore} is closed.
+ */
+public class CatalogStoreHolder implements AutoCloseable {

Review Comment:
   @Internal



##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CommonCatalogOptions.java:
##########
@@ -41,4 +41,14 @@ public class CommonCatalogOptions {
      */
     public static final ConfigOption<String> CATALOG_TYPE =
             ConfigOptions.key("type").stringType().noDefaultValue();
+
+    public static final String DEFAULT_CATALOG_STORE_TYPE = 
"generic_in_memory";

Review Comment:
   DEFAULT_CATALOG_STORE_KIND ?



##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CommonCatalogOptions.java:
##########
@@ -41,4 +41,14 @@ public class CommonCatalogOptions {
      */
     public static final ConfigOption<String> CATALOG_TYPE =
             ConfigOptions.key("type").stringType().noDefaultValue();
+
+    public static final String DEFAULT_CATALOG_STORE_TYPE = 
"generic_in_memory";

Review Comment:
   DEFAULT_CATALOG_STORE_KIND ?



-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to