This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch camel-4.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.0.x by this push:
new 850af32416b CAMEL-19815: avoid using invalid QueueReferences (#11253)
(#11254)
850af32416b is described below
commit 850af32416bbb4ea22936877230f1b28d1eddc19
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Thu Aug 31 15:08:03 2023 +0200
CAMEL-19815: avoid using invalid QueueReferences (#11253) (#11254)
This partially reverts the changes introduced on
23542fc5b65f33cde0f74f71876fe80d8c8c853f and
b70584ddb3545a87acc1732f0e89b9cea704c461
---
.../apache/camel/component/seda/SedaEndpoint.java | 25 ++++++----------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
index f1934eb03e1..116424dfe30 100644
---
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
+++
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
@@ -101,7 +101,6 @@ public class SedaEndpoint extends DefaultEndpoint
implements AsyncEndpoint, Brow
private boolean discardIfNoConsumers;
private BlockingQueueFactory<Exchange> queueFactory;
- private volatile QueueReference ref;
public SedaEndpoint() {
queueFactory = new LinkedBlockingQueueFactory<>();
@@ -215,23 +214,14 @@ public class SedaEndpoint extends DefaultEndpoint
implements AsyncEndpoint, Brow
* @return the reference, or <tt>null</tt> if no queue reference exists.
*/
public QueueReference getQueueReference() {
- if (ref == null) {
- ref = tryQueueRefInit();
- }
-
- return ref;
- }
+ String key = getComponent().getQueueKey(getEndpointUri());
- private QueueReference tryQueueRefInit() {
- final SedaComponent component = getComponent();
- if (component != null) {
- final String key = component.getQueueKey(getEndpointUri());
- return component.getQueueReference(key);
+ synchronized (this) {
+ return getComponent().getQueueReference(key);
}
-
- return null;
}
+
protected synchronized AsyncProcessor getConsumerMulticastProcessor() {
if (!multicastStarted && consumerMulticastProcessor != null) {
// only start it on-demand to avoid starting it during stopping
@@ -548,8 +538,6 @@ public class SedaEndpoint extends DefaultEndpoint
implements AsyncEndpoint, Brow
if (queue == null) {
queue = getQueue();
}
-
- ref = tryQueueRefInit();
}
@Override
@@ -559,8 +547,6 @@ public class SedaEndpoint extends DefaultEndpoint
implements AsyncEndpoint, Brow
} else {
LOG.debug("There is still active consumers.");
}
-
- ref = null;
}
@Override
@@ -592,7 +578,8 @@ public class SedaEndpoint extends DefaultEndpoint
implements AsyncEndpoint, Brow
// clear queue, as we are shutdown, so if re-created then the queue
must be updated
queue = null;
- ref = null;
}
+
+
}