durdin85 commented on code in PR #14677:
URL: https://github.com/apache/cloudstack/pull/14677#discussion_r4691917545


##########
plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java:
##########
@@ -540,35 +649,38 @@ public void shutdownCompleted(ShutdownSignalException 
shutdownSignalException) {
                 }
 
                 abortConnection(); // disconnected to AMQP server, so abort 
the connection and channels
+                // the ReconnectionTask started with the event bus takes care 
of the re-connect
                 logger.warn("Connection has been shutdown by AMQP server. 
Attempting to reconnect.");
-
-                // initiate re-connect process
-                ReconnectionTask reconnect = new ReconnectionTask();
-                executorService.submit(reconnect);
             }
         }
     }
 
-    // retry logic to connect back to AMQP server after loss of connection
+    // runs for the lifetime of the event bus: connects back to AMQP server 
after any loss of connection
+    // and sends the events buffered in the meantime
     private class ReconnectionTask extends ManagedContextRunnable {
 
-        boolean connected = false;
         Connection connection = null;
 
         @Override
         protected void runInContext() {
 
-            while (!connected) {
+            while (true) {

Review Comment:
   I was thinking about that, and instead of the endless loop, the loop content 
might be moved to the SingleThreadScheduledExecutor, which then does the 
repetition, and should be guaranteed to be in order and unique. There's second 
endless loop in buffer flush, but that can be easily fixed.



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