You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "SpriCoder (via GitHub)" <gi...@apache.org> on 2023/03/10 03:26:19 UTC

[GitHub] [iotdb] SpriCoder commented on a diff in pull request #9270: [IOTDB-5368] add port check for confignode and datanode

SpriCoder commented on code in PR #9270:
URL: https://github.com/apache/iotdb/pull/9270#discussion_r1131910382


##########
confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java:
##########
@@ -31,18 +32,39 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * ConfigNodeStartupCheck checks the parameters in iotdb-confignode.properties and
  * confignode-system.properties when start and restart
  */
-public class ConfigNodeStartupCheck {
+public class ConfigNodeStartupCheck extends StartupChecks {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(ConfigNodeStartupCheck.class);
 
   private static final ConfigNodeConfig CONF = ConfigNodeDescriptor.getInstance().getConf();
 
+  public ConfigNodeStartupCheck(String nodeRole) {
+    super(nodeRole);
+  }
+
+  private void portCheck() throws StartupException {
+    Set<Integer> portSet = new HashSet<>();
+    int configNodePort = 2;

Review Comment:
   Please do nothing use Hard Code here. A good solution is use static final params



##########
node-commons/src/main/java/org/apache/iotdb/commons/service/StartupChecks.java:
##########
@@ -43,19 +45,17 @@ public class StartupChecks {
           logger.info("JDK version is {}.", version);
         }
       };
-  private final List<StartupCheck> preChecks = new ArrayList<>();
-  private final List<StartupCheck> defaultTests = new ArrayList<>();
+  protected final List<StartupCheck> preChecks = new ArrayList<>();
 
-  public StartupChecks(String nodeRole) {
-    defaultTests.add(() -> checkJMXPort(nodeRole));
-    defaultTests.add(checkJDK);
+  protected StartupChecks(String nodeRole) {
+    this.nodeRole = nodeRole;
   }
 
   private void checkJMXPort(String nodeRole) {
     Boolean jmxLocal = Boolean.valueOf(System.getProperty(IoTDBConstant.IOTDB_JMX_LOCAL));
     String jmxPort = System.getProperty(IoTDBConstant.IOTDB_JMX_PORT);
 
-    if (jmxLocal) {
+    if (Boolean.TRUE.equals(jmxLocal)) {

Review Comment:
   Why use equals here?



-- 
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: reviews-unsubscribe@iotdb.apache.org

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