You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/03/24 06:09:34 UTC

[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #3342: [INLONG-3328][Sort-Standalone] Support to load sort-sdk configuration from file in Sort-standalone

luchunliang commented on a change in pull request #3342:
URL: https://github.com/apache/incubator-inlong/pull/3342#discussion_r833946459



##########
File path: inlong-sort-standalone/sort-standalone-common/src/main/java/org/apache/inlong/sort/standalone/config/holder/SortClusterConfigHolder.java
##########
@@ -68,16 +69,24 @@ private static SortClusterConfigHolder get() {
         synchronized (SortClusterConfigHolder.class) {
             instance = new SortClusterConfigHolder();
             instance.reloadInterval = CommonPropertiesHolder.getLong(RELOAD_INTERVAL, 60000L);
-            String loaderType = CommonPropertiesHolder.getString(SORT_CLUSTER_CONFIG_TYPE,
-                    ClassResourceSortClusterConfigLoader.class.getName());
-            try {
-                Class<?> loaderClass = ClassUtils.getClass(loaderType);
-                Object loaderObject = loaderClass.getDeclaredConstructor().newInstance();
-                if (loaderObject instanceof SortClusterConfigLoader) {
-                    instance.loader = (SortClusterConfigLoader) loaderObject;
+            String loaderType = CommonPropertiesHolder
+                    .getString(SortClusterConfigType.KEY_TYPE, SortClusterConfigType.MANAGER.name())
+                    .toUpperCase(Locale.getDefault());
+
+            if (SortClusterConfigType.FILE.name().equals(loaderType)) {
+                instance.loader = new ClassResourceSortClusterConfigLoader();
+            } else if (SortClusterConfigType.MANAGER.name().equals(loaderType)) {
+                instance.loader = new ManagerSortClusterConfigLoader();
+            } else {
+                // user-defined
+                try {
+                    Class<?> loaderClass = ClassUtils.getClass(loaderType);
+                    Object loaderObject = loaderClass.getDeclaredConstructor().newInstance();
+                    if (loaderObject instanceof SortClusterConfigLoader) {

Review comment:
       fixed it




-- 
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: commits-unsubscribe@inlong.apache.org

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