FangYongs commented on code in PR #22937:
URL: https://github.com/apache/flink/pull/22937#discussion_r1260545206


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/CatalogStoreFactory.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * 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.factories;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.catalog.CatalogStore;
+import org.apache.flink.table.catalog.exceptions.CatalogException;
+
+import java.util.Map;
+
+/**
+ * A factory to create configured catalog store instances based on 
string-based properties. See also
+ * {@link Factory} for more information.
+ *
+ * <p>This factory is specifically designed for the Flink SQL gateway 
scenario, where different
+ * catalog stores need to be created for different sessions.
+ *
+ * <p>If the CatalogStore is implemented using JDBC, this factory can be used 
to create a JDBC
+ * connection pool in the open method. This connection pool can then be reused 
for subsequent
+ * catalog store creations.
+ *
+ * <p>The following examples implementation of CatalogStoreFactory using jdbc.
+ *
+ * <pre>{@code
+ *     public class JdbcCatalogStore implements CatalogStore {
+ *
+ *         private JdbcConnectionPool jdbcConnectionPool;
+ *         public JdbcCatalogStore(JdbcConnectionPool jdbcConnectionPool) {
+ *             this.jdbcConnectionPool = jdbcConnectionPool;
+ *         }
+ *         ...
+ *     }
+ *
+ *     public class JdbcCatalogStoreFactory implements CatalogStoreFactory {
+ *
+ *         private JdbcConnectionPool jdbcConnectionPool;
+ *
+ *         @Override
+ *         public CatalogStore createCatalogStore(Context context) {
+ *             return new JdbcCatalogStore(jdbcConnectionPool);
+ *         }
+ *
+ *         @Override
+ *         public void open(Context context) throws CatalogException {
+ *             // initialize the thread pool using options from context
+ *             jdbcConnectionPool = initializeJdbcConnectionPool(context);
+ *         }
+ *         ...

Review Comment:
   Add `close` for JdbcCatalogStoreFactory? I think the `close` is very special 
for jdbc catalog store factory



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