fsk119 commented on code in PR #20101: URL: https://github.com/apache/flink/pull/20101#discussion_r925140186
########## flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/context/SessionContext.java: ########## @@ -157,10 +148,39 @@ public synchronized void reset() { // Method to execute commands // -------------------------------------------------------------------------------------------- + public void registerCatalog(String catalogName, Catalog catalog) { + sessionState.catalogManager.registerCatalog(catalogName, catalog); + } + + public void registerModule(String moduleName, Module module) { + sessionState.moduleManager.loadModule(moduleName, module); + } + + public void setCurrentCatalog(String catalog) { + sessionState.catalogManager.setCurrentCatalog(catalog); + } + + public void setCurrentDatabase(String database) { + sessionState.catalogManager.setCurrentDatabase(database); + } + public OperationExecutor createOperationExecutor(Configuration executionConfig) { return new OperationExecutor(this, executionConfig); } + /** Close resources, e.g. catalogs. */ + public void close() { + operationManager.close(); + for (String name : sessionState.catalogManager.listCatalogs()) { + sessionState.catalogManager.getCatalog(name).ifPresent(Catalog::close); Review Comment: Yes. It might get a resource leak if one of the catalogs fails to close. -- 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