javeme commented on code in PR #2676:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2676#discussion_r1818081274


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java:
##########
@@ -228,6 +238,32 @@ protected boolean graphIsReady() {
         return !this.closed && this.graph.started() && 
this.graph.initialized();
     }
 
+    protected synchronized void updateIsSingleNode(){
+        Collection<HugeServerInfo> servers=this.allServerInfos();
+        boolean hasWorkerNode = false;
+        long now = DateUtil.now().getTime();
+        int computerNodeCount=0;
+
+        // Iterate servers to find suitable one
+        for (HugeServerInfo server : servers) {
+            if (!server.alive()) {
+                continue;
+            }
+            if (server.role().master()) {
+                continue;
+            }else if (server.role().computer()){

Review Comment:
   add a space after '}', or remove 'else'



##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java:
##########
@@ -228,6 +238,32 @@ protected boolean graphIsReady() {
         return !this.closed && this.graph.started() && 
this.graph.initialized();
     }
 
+    protected synchronized void updateIsSingleNode(){
+        Collection<HugeServerInfo> servers=this.allServerInfos();
+        boolean hasWorkerNode = false;
+        long now = DateUtil.now().getTime();
+        int computerNodeCount=0;
+
+        // Iterate servers to find suitable one
+        for (HugeServerInfo server : servers) {
+            if (!server.alive()) {
+                continue;
+            }
+            if (server.role().master()) {
+                continue;
+            }else if (server.role().computer()){
+                computerNodeCount++;
+            }
+            hasWorkerNode = true;
+        }
+
+        boolean singleNode = !hasWorkerNode||computerNodeCount==1;
+        if (singleNode != this.onlySingleNode) {
+            LOG.info("Switch only_single_node 02 to {}", singleNode);

Review Comment:
   not sure `02` means what



##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java:
##########
@@ -172,8 +172,18 @@ public NodeRole selfNodeRole() {
         return this.globalNodeInfo.nodeRole();
     }
 
-    public boolean selfIsMaster() {
-        return this.selfNodeRole() != null && this.selfNodeRole().master();
+    public boolean selfIsMasterOrSingleComputer() {
+        boolean isMaster=this.selfNodeRole() != null && 
this.selfNodeRole().master();
+        boolean isSingleComputer=isStandAloneComputer();
+        return isMaster||isSingleComputer;
+    }
+
+    public boolean selfIsComputer() {
+        return this.selfNodeRole() != null && this.selfNodeRole().computer();
+    }
+
+    public boolean isStandAloneComputer(){

Review Comment:
   unused method?



##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java:
##########
@@ -172,8 +172,18 @@ public NodeRole selfNodeRole() {
         return this.globalNodeInfo.nodeRole();
     }
 
-    public boolean selfIsMaster() {
-        return this.selfNodeRole() != null && this.selfNodeRole().master();
+    public boolean selfIsMasterOrSingleComputer() {
+        boolean isMaster=this.selfNodeRole() != null && 
this.selfNodeRole().master();
+        boolean isSingleComputer=isStandAloneComputer();

Review Comment:
   expect spaces " = "



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to