essobedo commented on code in PR #11279:
URL: https://github.com/apache/camel/pull/11279#discussion_r1313133797


##########
components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java:
##########
@@ -174,32 +174,41 @@ public PollingConsumer createPollingConsumer() throws 
Exception {
         return answer;
     }
 
-    public synchronized BlockingQueue<Exchange> getQueue() {
+    public BlockingQueue<Exchange> getQueue() {
         if (queue == null) {
-            // prefer to lookup queue from component, so if this endpoint is 
re-created or re-started
-            // then the existing queue from the component can be used, so new 
producers and consumers
-            // can use the already existing queue referenced from the component
-            if (getComponent() != null) {
-                // use null to indicate default size (= use what the existing 
queue has been configured with)
-                Integer size = (getSize() == Integer.MAX_VALUE || getSize() == 
SedaConstants.QUEUE_SIZE) ? null : getSize();
-                QueueReference ref = getComponent().getOrCreateQueue(this, 
size, isMultipleConsumers(), queueFactory);
-                queue = ref.getQueue();
-                String key = getComponent().getQueueKey(getEndpointUri());
-                LOG.debug("Endpoint {} is using shared queue: {} with size: 
{}", this, key,
-                        ref.getSize() != null ? ref.getSize() : 
Integer.MAX_VALUE);
-                // and set the size we are using
-                if (ref.getSize() != null) {
-                    setSize(ref.getSize());
+            synchronized (this) {
+                if (queue == null) {

Review Comment:
   Warning, queue is not volatile so this is not thread-safe



-- 
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...@camel.apache.org

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

Reply via email to