DaanHoogland commented on code in PR #11330:
URL: https://github.com/apache/cloudstack/pull/11330#discussion_r2239801588


##########
agent/src/main/java/com/cloud/agent/Agent.java:
##########
@@ -968,9 +968,11 @@ private Answer migrateAgentToOtherMS(final 
MigrateAgentConnectionCommand cmd) {
             if (CollectionUtils.isNotEmpty(cmd.getMsList())) {
                 processManagementServerList(cmd.getMsList(), 
cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval(), false);
             }
-            Executors.newSingleThreadScheduledExecutor(new 
NamedThreadFactory("MigrateAgentConnection-Job")).schedule(() -> {
+            ScheduledExecutorService migrateAgentConnectionService = 
Executors.newSingleThreadScheduledExecutor(new 
NamedThreadFactory("MigrateAgentConnection-Job"));
+            migrateAgentConnectionService.schedule(() -> {
                 migrateAgentConnection(cmd.getAvoidMsList());
             }, 3, TimeUnit.SECONDS);
+            migrateAgentConnectionService.shutdown();

Review Comment:
   we should not continue toi shutdown when agent migration to another 
managemenet server has failed.



-- 
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: commits-unsubscr...@cloudstack.apache.org

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

Reply via email to