You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/10/21 12:37:53 UTC

[GitHub] [skywalking] kezhenxu94 commented on a diff in pull request #9828: Add new config initialization mechanism of module provider to replace existing

kezhenxu94 commented on code in PR #9828:
URL: https://github.com/apache/skywalking/pull/9828#discussion_r1001736185


##########
oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleProvider.java:
##########
@@ -52,9 +52,28 @@ protected final ModuleManager getManager() {
     public abstract Class<? extends ModuleDefine> module();
 
     /**
-     *
+     * Create a config creator to initialize this configuration of this module provider
+     * @return creator instance to initialize the configuration with callback. Or return null if no config is required.
      */
-    public abstract ModuleConfig createConfigBeanIfAbsent();
+    public abstract ConfigCreator newConfigCreator();
+
+    /**
+     * Configuration creator to provide Module Config to initialize
+     * @param <T> class type of the config
+     */
+    public interface ConfigCreator<T extends ModuleConfig> {
+        /**
+         * Declare the type of the config class
+         * @return class type
+         */
+        Class<T> type();
+
+        /**
+         * Callback when the ModuleManager kernel has initialized this configuration.
+         * @param initialized instance of the given {@link #type()}
+         */
+        void onInitialized(T initialized);

Review Comment:
   I'm wondering whether we can lift this method up the the class `ModuleProvider`, because IMO `onInitialized` is a lifecycle method just similar to `ModuleProvider.prepare`, `ModuleProvider.start`, `ModuleProvider.notifyAfterCompleted`, etc., maybe we can unify the lifecycle methods together. And the changes should become very minimal



-- 
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: notifications-unsubscribe@skywalking.apache.org

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