rhtyd commented on a change in pull request #2309: CLOUDSTACK-10132: Multiple 
Management Servers Support for agents
URL: https://github.com/apache/cloudstack/pull/2309#discussion_r150465147
 
 

 ##########
 File path: agent/src/com/cloud/agent/AgentShell.java
 ##########
 @@ -107,18 +111,48 @@ public String getPod() {
     }
 
     @Override
-    public String getHost() {
-        final String[] hosts = _host.split(",");
+    public String getNextHost() {
+        final String[] hosts = getHosts();
         if (_hostCounter >= hosts.length) {
             _hostCounter = 0;
         }
-        final String host = hosts[_hostCounter % hosts.length];
+        connectedHost = hosts[_hostCounter % hosts.length];
         _hostCounter++;
-        return host;
+        s_logger.info("Connecting to host: " + connectedHost);
 
 Review comment:
   This method only returns the next possible host in list, however, this does 
not mean we're connected to the host yet. This might cause threading issues, 
and in rare cases the connectedHost might not be the connected host. Reconsider 
how this could be re-written, perhaps the connectedHost can be updated using 
one of the `Task.CONNECT` handlers.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to