lasdf1234 commented on code in PR #11209:
URL: https://github.com/apache/gravitino/pull/11209#discussion_r3298096104
##########
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/storage/relational/IdpRelationalStorage.java:
##########
@@ -30,28 +31,26 @@
import org.apache.gravitino.storage.relational.session.SqlSessionFactoryHelper;
/** JDBC bootstrap for built-in IdP relational storage. */
-public final class IdpRelationalStorage {
+public final class IdpRelationalStorage implements Closeable {
private static final Map<JDBCBackendType, String> EMBEDDED_JDBC_DATABASE_MAP
=
ImmutableMap.of(JDBCBackendType.H2, H2Database.class.getCanonicalName());
- private static JDBCDatabase jdbcDatabase;
-
- private IdpRelationalStorage() {}
+ private JDBCDatabase jdbcDatabase;
/**
* Initializes the JDBC session factory and optional embedded database.
*
* @param config The server configuration.
*/
- public static void initialize(Config config) {
+ public IdpRelationalStorage(Config config) {
Review Comment:
1.This class has a clear init/close lifecycle, and the binding with the
manager is more explicit.
2.SqlSessionFactoryHelper and metaService have already been singleton.
3.This class is generated based on the JDBCBackend in core module.If we
consider the same perspective as the previous code, it would be better not to
use "single".
In the subsequent PR, it is guaranteed that this method will only be called
once during startup.
--
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]