samratdhillon opened a new pull request #5618:
URL: https://github.com/apache/camel/pull/5618


   - Fixing https://issues.apache.org/jira/browse/CAMEL-16681 
   - Using LazyStartProducer in multithreaded context can result in exceptions. 
The fix is basically starting the producer in the same lock when it is 
initialized. If the producer was not created to begin with then it has 
definitely not been started as well. Starting the producer outside the lock can 
result in race condition where some threads see the service in STARTING state 
and org.apache.camel.support.service.ServiceHelper.isStarted(Object) returns 
true. This results in  LazyStartProducer assuming that the producer is fully 
initialized. The producer is not fully initialized until 
ServiceHelper.startService(delegate) returns after starting the delegate 
producer. Hence the delegate producer should be started in the same lock where 
delegate is initialized so that other threads do not start using the producer 
in half baked state.


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

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


Reply via email to