This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 05c1a84  fixing Camel-16681 where LazyStartProducer can result in 
Exceptions when used in multithreaded context (#5620)
05c1a84 is described below

commit 05c1a846c8edad9c0e78fb9dc3f2f99771a35f56
Author: Samrat Dhillon <samrat.dhil...@gmail.com>
AuthorDate: Wed Jun 2 09:42:00 2021 -0400

    fixing Camel-16681 where LazyStartProducer can result in Exceptions when 
used in multithreaded context (#5620)
    
    Co-authored-by: Samrat Dhillon <samrat.dhil...@innovapost.com>
---
 .../src/main/java/org/apache/camel/support/LazyStartProducer.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/LazyStartProducer.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/LazyStartProducer.java
index 0a94030..bdf8d670 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/LazyStartProducer.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/LazyStartProducer.java
@@ -44,11 +44,11 @@ public final class LazyStartProducer extends 
DefaultAsyncProducer implements Del
                     if (delegate == null) {
                         delegate = 
AsyncProcessorConverterHelper.convert(getEndpoint().createProducer());
                     }
+                    if (!ServiceHelper.isStarted(delegate)) {
+                        ServiceHelper.startService(delegate);
+                    }
                 }
             }
-            if (!ServiceHelper.isStarted(delegate)) {
-                ServiceHelper.startService(delegate);
-            }
         } catch (Throwable e) {
             exchange.setException(e);
             callback.done(true);

Reply via email to