vernedeng commented on a change in pull request #3244:
URL: https://github.com/apache/incubator-inlong/pull/3244#discussion_r830550118



##########
File path: 
inlong-sort-standalone/sort-standalone-common/src/main/java/org/apache/inlong/sort/standalone/config/holder/ManagerAddrGetHandler.java
##########
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.sort.standalone.config.holder;
+
+import org.apache.commons.lang.ClassUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.flume.Context;
+import org.apache.flume.conf.Configurable;
+import org.apache.inlong.sort.standalone.utils.InlongLoggerFactory;
+import org.slf4j.Logger;
+
+import java.util.Optional;
+
+/**
+ * Manager address get handler.
+ *
+ * <p> Used to acquire the ip and port of manager, which sort sdk and 
sort-standalone request config from. </p>
+ * <p> The default implementation is base on {@link CommonPropertiesHolder} to 
acquire properties. </p>
+ */
+public class ManagerAddrGetHandler implements Configurable {
+
+    private static final Logger LOG = 
InlongLoggerFactory.getLogger(ManagerAddrGetHandler.class);
+    private static final String KEY_MANAGER_ADDR_GET_HANDLER_TYPE = 
"ManagerAddrGetHandler";
+    private static final String KEY_SORT_CLUSTER_CONFIG_MANAGER_URL = 
"sortClusterConfig.managerUrl";
+    private static final String KEY_SORT_SOURCE_CONFIG_MANAGER_URL = 
"sortSourceConfig.managerUrl";
+
+    private static ManagerAddrGetHandler instance;
+
+    public Context context;
+
+    /**
+     * Delete no argument constructor.
+     */
+    private ManagerAddrGetHandler() {
+
+    }
+
+    /**
+     * Get URL where SortSdk request SortSourceConfig.
+     *
+     * @return URL to get SortSourceConfig.
+     */
+    public static String getSortSourceConfigUrl() {
+        String url = 
get().context.getString(KEY_SORT_SOURCE_CONFIG_MANAGER_URL);
+        if (StringUtils.isBlank(url)) {
+            LOG.error("Get SortSourceConfigUrl from CommonPropertiesHolder 
failed, "
+                    + "please check if there is any property of key {}.", 
KEY_SORT_SOURCE_CONFIG_MANAGER_URL);
+        }
+        return url;
+    }
+
+    /**
+     * Get URL where Sort-Standalone request SortClusterConfig.
+     *
+     * @return URL to get SortClusterConfig.
+     */
+    public static String getSortClusterConfigUrl() {
+        String url = 
get().context.getString(KEY_SORT_CLUSTER_CONFIG_MANAGER_URL);

Review comment:
       fixed




-- 
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]


Reply via email to