gabrywu commented on a change in pull request #5814:
URL: https://github.com/apache/dolphinscheduler/pull/5814#discussion_r669240897



##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/RegistryCenterUtils.java
##########
@@ -36,21 +36,14 @@
  * fixme Some of the information obtained in the api belongs to the unique 
information of zk.
  * I am not sure whether there is a good abstraction method. This is related 
to whether the specific plug-in is provided.
  */
-@Component
-public class RegistryMonitor {
+public class RegistryCenterUtils {
 
-    @Autowired
-    RegistryClient registryClient;
-
-    @PostConstruct
-    public void initRegistry() {
-        registryClient.init();
-    }
+    private static RegistryClient registryClient = 
RegistryClient.getInstance();
 
     /**
      * @return zookeeper info list
      */
-    public List<ZookeeperRecord> zookeeperInfoList() {
+    public static List<ZookeeperRecord> zookeeperInfoList() {

Review comment:
       remove this method?

##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/RegistryCenterUtils.java
##########
@@ -106,11 +99,23 @@ public void initRegistry() {
         return list;
     }
 
-    public Map<String, String> getServerMaps(NodeType nodeType, boolean 
hostOnly) {
+    public static Map<String, String> getServerMaps(NodeType nodeType, boolean 
hostOnly) {
         return registryClient.getServerMaps(nodeType, hostOnly);
     }
 
-    public List<String> getServerNodeList(NodeType nodeType, boolean hostOnly) 
{
+    public static List<String> getServerNodeList(NodeType nodeType, boolean 
hostOnly) {
         return registryClient.getServerNodeList(nodeType, hostOnly);
     }
+
+    public static boolean isExisted(String key) {
+        return registryClient.isExisted(key);
+    }
+
+    public static List<String> getChildrenKeys(final String key) {

Review comment:
       getChildrenKeys & isExistted & getValue is meaningless for 
RegistryCenterUtils, should use a meaningful method name

##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
##########
@@ -147,7 +137,7 @@ private boolean checkWorkerGroupNameExists(WorkerGroup 
workerGroup) {
         }
         // check zookeeper
         String workerGroupPath = Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS + 
Constants.SLASH + workerGroup.getName();
-        return registryClient.isExisted(workerGroupPath);
+        return RegistryCenterUtils.isExisted(workerGroupPath);

Review comment:
       use a meaningful method name




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