leonardBang commented on code in PR #23036:
URL: https://github.com/apache/flink/pull/23036#discussion_r1271314505
##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/session/SessionManagerImpl.java:
##########
@@ -68,13 +73,16 @@ public class SessionManagerImpl implements SessionManager {
private @Nullable ScheduledExecutorService cleanupService;
private @Nullable ScheduledFuture<?> timeoutCheckerFuture;
+ private CatalogStoreFactory catalogStoreFactory;
+
public SessionManagerImpl(DefaultContext defaultContext) {
this.defaultContext = defaultContext;
ReadableConfig conf = defaultContext.getFlinkConfig();
this.idleTimeout =
conf.get(SQL_GATEWAY_SESSION_IDLE_TIMEOUT).toMillis();
this.checkInterval =
conf.get(SQL_GATEWAY_SESSION_CHECK_INTERVAL).toMillis();
this.maxSessionCount = conf.get(SQL_GATEWAY_SESSION_MAX_NUM);
this.sessions = new ConcurrentHashMap<>();
+ this.catalogStoreFactory = initCatalogStoreFactory(defaultContext);
Review Comment:
From my understanding, all resource initializing should happen in open/start
method.
##########
flink-table/flink-table-common/src/test/java/org/apache/flink/table/factories/TestCatalogStoreFactory.java:
##########
@@ -19,27 +19,37 @@
package org.apache.flink.table.factories;
import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.table.catalog.AbstractCatalogStore;
import org.apache.flink.table.catalog.CatalogDescriptor;
import org.apache.flink.table.catalog.CatalogStore;
import org.apache.flink.table.catalog.exceptions.CatalogException;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
-/** Test catalog store factory for catalog store discovery tests. */
+/**
+ * This class is an implementation of {@link CatalogStoreFactory} for testing
purposes. All
+ * instances of {@link CatalogStore} created by the same {@link
CatalogStoreFactory} will share the
+ * saved {@link CatalogDescriptor}s.
+ */
public class TestCatalogStoreFactory implements CatalogStoreFactory {
public static final String IDENTIFIER = "test-catalog-store";
+ private Map<String, CatalogDescriptor> sharedDescriptors;
Review Comment:
Looks like a static field is enough if we want to share something crossing
multiple instances?
--
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]