gnodet-bot commented on code in PR #30820:
URL: https://github.com/apache/camel/pull/30820#discussion_r4703460285


##########
components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorReference.java:
##########
@@ -171,8 +171,29 @@ public void reconfigure() throws Exception {
 
     private void start() throws Exception {
         LOGGER.debug("Starting disruptor {}", this);
-        Disruptor<ExchangeEvent> newDisruptor = createDisruptor();
+        Disruptor<ExchangeEvent> newDisruptor = null;
+        try {
+            newDisruptor = createDisruptor();
+            startDisruptor(newDisruptor);
+        } catch (Exception | Error e) {
+            // the reference was cleared and marked as being reconfigured, so 
producers wait for the new Disruptor: mark
+            // it as not started instead, so they fail (as when no Disruptor 
was started) instead of waiting forever
+            disruptor.set(null, false);
+            // and do not run the event processors of this Disruptor later on 
the executor (the next start would
+            // hand them over with its own), nor keep running the ones already 
handed over
+            delayedExecutor.clear();
+            if (newDisruptor != null) {
+                newDisruptor.halt();
+            }
+            handlers = new LifecycleAwareExchangeEventHandler[0];
+            LOGGER.warn("Failed to start disruptor {}, producers fail until it 
is started again ({} buffered exchanges are"
+                        + " kept until then): {}",

Review Comment:
   The log message says *"buffered exchanges are kept until then"* — this 
refers to `temporaryExchangeBuffer`, which holds exchanges buffered during the 
previous `shutdownDisruptor()` call. That part is accurate: those pre-existing 
exchanges survive and will be drained on the next successful start.
   
   However, new exchanges sent after the failed start will **not** be buffered 
— producers will fail immediately with `DisruptorNotStartedException`. The 
phrasing could be misread as "all exchanges sent during this window are 
buffered and replayed later." Consider clarifying:
   
   ```suggestion
               LOGGER.warn("Failed to start disruptor {}, producers fail until 
it is started again"
                           + " ({} exchanges buffered before this failure are 
kept until then): {}",
                       uri, temporaryExchangeBuffer.size(), e.toString());
   ```



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