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 115ecbfb4070 CAMEL-27413: camel-seda - a consumer started again while
its threads process exchanges no longer keeps the threads of the previous start
(#30757)
115ecbfb4070 is described below
commit 115ecbfb4070d24fc06e1d08dc377acd93af8713
Author: allthingssecurity <[email protected]>
AuthorDate: Wed Nov 25 16:45:36 2026 +0530
CAMEL-27413: camel-seda - a consumer started again while its threads
process exchanges no longer keeps the threads of the previous start (#30757)
SedaConsumer.doStop interrupts the polling threads and does not wait for
them. When a route policy stopped and started the same consumer while a
thread was processing an exchange, that thread kept polling after the
start: more threads polled than concurrentConsumers, while the latch of
the start counted concurrentConsumers, so a graceful shutdown could return
while a thread was still processing an exchange; and a thread whose
processor kept the interrupt flag of the stop failed every poll at once,
spun at 100% CPU and made each graceful shutdown wait for its timeout.
Each start now submits its own concurrentConsumers polling tasks, which
poll only while their start is the current one and count down the latch
of their start, and prepareShutdown also waits for the threads of earlier
starts that still process an exchange. ThreadPerTaskSedaConsumer says
through getPollingTasks() that it runs one coordinator thread instead of
replacing the latch after the tasks were submitted.
Found with a TLA+ model.
Also in this change:
- CAMEL-27413: camel-seda - review follow-up: upgrade guide entry for
doRun(int), comment on the earlier latches
- CAMEL-27413: camel-seda - review follow-up: isCurrentStart(int) for
subclasses that override doRun(int)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../apache/camel/component/seda/SedaConsumer.java | 100 +++++++---
.../component/seda/ThreadPerTaskSedaConsumer.java | 15 +-
.../seda/SedaConsumerIsCurrentStartTest.java | 65 +++++++
.../SedaConsumerRestartWhileProcessingTest.java | 202 +++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 9 +
5 files changed, 357 insertions(+), 34 deletions(-)
diff --git
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
index 3d0730be370e..85ae235d7197 100644
---
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
+++
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
@@ -17,7 +17,9 @@
package org.apache.camel.component.seda;
import java.util.List;
+import java.util.Queue;
import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
@@ -48,8 +50,13 @@ public class SedaConsumer extends DefaultConsumer implements
Runnable, ShutdownA
private static final Logger LOG =
LoggerFactory.getLogger(SedaConsumer.class);
- private final AtomicInteger taskCount = new AtomicInteger();
+ // each start of this consumer submits its own polling tasks, which poll
only while their start is the current one
+ // and count down the latch of their start when they end: doStop does not
wait for the polling threads, so a thread
+ // of an earlier start can still be processing an exchange when the
consumer is started again
+ private final AtomicInteger starts = new AtomicInteger();
protected volatile CountDownLatch latch;
+ // the latches of the earlier starts whose polling threads have not all
ended yet
+ private final Queue<CountDownLatch> earlierLatches = new
ConcurrentLinkedQueue<>();
private volatile boolean shutdownPending;
private volatile boolean forceShutdown;
private ExecutorService executor;
@@ -133,16 +140,24 @@ public class SedaConsumer extends DefaultConsumer
implements Runnable, ShutdownA
shutdownPending = true;
forceShutdown = forced;
- if (latch != null) {
- LOG.debug("Preparing to shutdown, waiting for {} consumer threads
to complete.", latch.getCount());
+ CountDownLatch current = latch;
+ if (current != null) {
+ LOG.debug("Preparing to shutdown, waiting for {} consumer threads
to complete.", current.getCount());
- // wait for all threads to end, using the shutdown strategy timeout
+ // wait for all threads to end, using the shutdown strategy
timeout: the threads of this start, and the
+ // threads of earlier starts still processing the exchange they
polled before the consumer was stopped
try {
long timeout =
getEndpoint().getCamelContext().getShutdownStrategy().getTimeout();
TimeUnit timeUnit =
getEndpoint().getCamelContext().getShutdownStrategy().getTimeUnit();
- if (!latch.await(timeout, timeUnit)) {
+ long deadline = System.nanoTime() + timeUnit.toNanos(timeout);
+ boolean done = current.await(timeout, timeUnit);
+ for (CountDownLatch earlier : earlierLatches) {
+ done = done && earlier.await(deadline - System.nanoTime(),
TimeUnit.NANOSECONDS);
+ }
+ if (!done) {
+ long left = current.getCount() +
earlierLatches.stream().mapToLong(CountDownLatch::getCount).sum();
LOG.warn("Timeout waiting for {} consumer threads to
complete during shutdown (waited {} {}).",
- latch.getCount(), timeout, timeUnit);
+ left, timeout, timeUnit);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -167,22 +182,45 @@ public class SedaConsumer extends DefaultConsumer
implements Runnable, ShutdownA
@Override
public void run() {
- taskCount.incrementAndGet();
+ // a thread that runs this consumer directly polls for the current
start
+ run(starts.get(), latch);
+ }
+
+ private void run(int start, CountDownLatch startLatch) {
try {
- doRun();
+ doRun(start);
} finally {
- taskCount.decrementAndGet();
- if (latch != null) {
- latch.countDown();
- LOG.debug("Ending this polling consumer thread, there are
still {} consumer threads left.", latch.getCount());
+ if (startLatch != null) {
+ startLatch.countDown();
+ LOG.debug("Ending this polling consumer thread, there are
still {} consumer threads left.",
+ startLatch.getCount());
}
}
}
- protected void doRun() {
+ /**
+ * Whether the given start is the current start of this consumer. A
subclass that overrides {@link #doRun(int)}
+ * polls only while this returns true (and {@link #isRunAllowed()} is
true), so that its threads stop polling once
+ * the consumer was stopped and started again.
+ *
+ * @param start the start of this consumer that submitted the polling task
+ * @return true if no later start has happened since
+ */
+ protected boolean isCurrentStart(int start) {
+ return start == starts.get();
+ }
+
+ /**
+ * Polls the queue and processes the exchanges while the given start is
the current start of this consumer.
+ *
+ * @param start the start of this consumer that submitted the polling task
+ */
+ protected void doRun(int start) {
BlockingQueue<Exchange> queue = getEndpoint().getQueue();
- // loop while we are allowed, or if we are stopping loop until the
queue is empty
- while (queue != null && isRunAllowed()) {
+ // loop while we are allowed, or if we are stopping loop until the
queue is empty. A thread of an earlier start
+ // (still processing an exchange when the consumer was stopped and
started again) stops polling: this start
+ // has its own threads, and the earlier stop may have interrupted this
thread, so its polls would only fail
+ while (queue != null && isCurrentStart(start) && isRunAllowed()) {
// do not poll during CamelContext is starting, as we should only
poll when CamelContext is fully started
if (getEndpoint().getCamelContext().getStatus().isStarting()) {
@@ -383,9 +421,17 @@ public class SedaConsumer extends DefaultConsumer
implements Runnable, ShutdownA
@Override
protected void doStart() throws Exception {
super.doStart();
- if (getEndpoint().getConcurrentConsumers() > 0) {
- latch = new CountDownLatch(getEndpoint().getConcurrentConsumers());
+ // the threads of the previous start (doStop does not wait for them)
end after the exchange they are processing,
+ // and a graceful shutdown waits for them too
+ CountDownLatch previous = latch;
+ if (previous != null && previous.getCount() > 0) {
+ earlierLatches.add(previous);
}
+ // a latch is only dropped here, at a later start, once its count is
0: every polling task gets a worker of its
+ // own from the fixed pool, so each task runs and counts down the
latch of its start
+ earlierLatches.removeIf(l -> l.getCount() == 0);
+ starts.incrementAndGet();
+ latch = new CountDownLatch(getPollingTasks());
shutdownPending = false;
forceShutdown = false;
@@ -446,7 +492,14 @@ public class SedaConsumer extends DefaultConsumer
implements Runnable, ShutdownA
}
/**
- * Setup the thread pool and ensures tasks gets executed (if needed)
+ * The number of polling tasks each start of this consumer submits:
concurrentConsumers, at least one.
+ */
+ protected int getPollingTasks() {
+ return Math.max(1, getEndpoint().getConcurrentConsumers());
+ }
+
+ /**
+ * Setup the thread pool and submits the polling tasks of this start
*/
protected void setupTasks() {
int poolSize = getEndpoint().getConcurrentConsumers();
@@ -456,14 +509,13 @@ public class SedaConsumer extends DefaultConsumer
implements Runnable, ShutdownA
executor = createExecutor(poolSize);
}
- // submit needed number of tasks
- int tasks = poolSize - taskCount.get();
- if (tasks <= 0) {
- tasks = 1;
- }
+ // submit the tasks of this start: each polls while this start is the
current one, and counts down its latch
+ final int start = starts.get();
+ final CountDownLatch startLatch = latch;
+ int tasks = getPollingTasks();
LOG.debug("Creating {} queue pooler with poll timeout {} ms.", tasks,
pollTimeout);
for (int i = 0; i < tasks; i++) {
- executor.execute(this);
+ executor.execute(() -> run(start, startLatch));
}
}
diff --git
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/ThreadPerTaskSedaConsumer.java
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/ThreadPerTaskSedaConsumer.java
index 3380efdd1755..6155f47277b4 100644
---
a/components/camel-seda/src/main/java/org/apache/camel/component/seda/ThreadPerTaskSedaConsumer.java
+++
b/components/camel-seda/src/main/java/org/apache/camel/component/seda/ThreadPerTaskSedaConsumer.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.seda;
-import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
@@ -70,15 +69,11 @@ public class ThreadPerTaskSedaConsumer extends SedaConsumer
{
}
@Override
- protected void doStart() throws Exception {
- super.doStart();
- // SedaConsumer.doStart() creates the latch with concurrentConsumers
count,
- // but ThreadPerTaskSedaConsumer uses a single coordinator thread that
polls
- // the queue and dispatches each exchange to the task executor.
- // The concurrentConsumers value is used here as a concurrency limit
for the
- // task executor (via a Semaphore), not as the number of polling
threads.
- // Override the latch to match the actual coordinator thread count (1).
- latch = new CountDownLatch(1);
+ protected int getPollingTasks() {
+ // a single coordinator thread polls the queue and dispatches each
exchange to the task executor. The
+ // concurrentConsumers value is used here as a concurrency limit for
the task executor (via a Semaphore), not as
+ // the number of polling threads
+ return 1;
}
@Override
diff --git
a/core/camel-core/src/test/java/org/apache/camel/component/seda/SedaConsumerIsCurrentStartTest.java
b/core/camel-core/src/test/java/org/apache/camel/component/seda/SedaConsumerIsCurrentStartTest.java
new file mode 100644
index 000000000000..e61d235806f5
--- /dev/null
+++
b/core/camel-core/src/test/java/org/apache/camel/component/seda/SedaConsumerIsCurrentStartTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.seda;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.support.service.ServiceHelper;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * A subclass of SedaConsumer that overrides doRun(int) can tell with
isCurrentStart(int) whether the start of its
+ * polling task is still the current start of the consumer.
+ */
+class SedaConsumerIsCurrentStartTest extends ContextTestSupport {
+
+ @Test
+ void testSubclassSeesItsStartEndAfterARestart() throws Exception {
+ SedaEndpoint endpoint =
context.getEndpoint("seda:sub?pollTimeout=100", SedaEndpoint.class);
+ BlockingQueue<Integer> runStarts = new LinkedBlockingQueue<>();
+ SedaConsumer consumer = new SedaConsumer(endpoint, exchange -> {
+ }) {
+ @Override
+ protected void doRun(int start) {
+ runStarts.add(start);
+ super.doRun(start);
+ }
+ };
+ try {
+ ServiceHelper.startService(consumer);
+ Integer first = runStarts.poll(5, TimeUnit.SECONDS);
+ assertNotNull(first, "the polling task of the first start did not
run");
+ assertTrue(consumer.isCurrentStart(first));
+
+ ServiceHelper.stopService(consumer);
+ ServiceHelper.startService(consumer);
+ Integer second = runStarts.poll(5, TimeUnit.SECONDS);
+ assertNotNull(second, "the polling task of the second start did
not run");
+ assertFalse(consumer.isCurrentStart(first), "the first start is
still the current one after a restart");
+ assertTrue(consumer.isCurrentStart(second));
+ } finally {
+ ServiceHelper.stopService(consumer);
+ }
+ }
+}
diff --git
a/core/camel-core/src/test/java/org/apache/camel/component/seda/SedaConsumerRestartWhileProcessingTest.java
b/core/camel-core/src/test/java/org/apache/camel/component/seda/SedaConsumerRestartWhileProcessingTest.java
new file mode 100644
index 000000000000..1f8733dadeb8
--- /dev/null
+++
b/core/camel-core/src/test/java/org/apache/camel/component/seda/SedaConsumerRestartWhileProcessingTest.java
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.seda;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.support.service.ServiceHelper;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import static org.awaitility.Awaitility.await;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The same SedaConsumer is stopped and started again while its threads
process exchanges, as a route policy does with
+ * ServiceHelper.stopService and startService (RoutePolicySupport.stopConsumer
and startConsumer, used by the leader
+ * election policies). The stop interrupts the threads and does not wait for
them; the processor here does not react to
+ * the interrupt (like a blocking call that cannot be interrupted).
+ */
+class SedaConsumerRestartWhileProcessingTest extends ContextTestSupport {
+
+ private final AtomicInteger active = new AtomicInteger();
+ private final AtomicInteger maxActive = new AtomicInteger();
+ private final AtomicInteger processed = new AtomicInteger();
+ // the release latch of each body that holds the thread, and the thread
that processes it
+ private final Map<String, CountDownLatch> releases = new
ConcurrentHashMap<>();
+ private final Map<String, Thread> threads = new ConcurrentHashMap<>();
+ private final Map<String, CountDownLatch> busy = new ConcurrentHashMap<>();
+
+ @AfterEach
+ void releaseAll() {
+ releases.values().forEach(CountDownLatch::countDown);
+ }
+
+ private void hold(String body, boolean keepInterrupt) {
+ threads.put(body, Thread.currentThread());
+ busy.computeIfAbsent(body, b -> new CountDownLatch(1)).countDown();
+ CountDownLatch release = releases.computeIfAbsent(body, b -> new
CountDownLatch(1));
+ boolean interrupted = false;
+ while (true) {
+ try {
+ release.await(30, TimeUnit.SECONDS);
+ break;
+ } catch (InterruptedException e) {
+ interrupted = true;
+ }
+ }
+ if (interrupted && keepInterrupt) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ private void sendAndWaitBusy(String... bodies) throws Exception {
+ for (String body : bodies) {
+ busy.computeIfAbsent(body, b -> new CountDownLatch(1));
+ template.sendBody("seda:foo", body);
+ }
+ for (String body : bodies) {
+ assertTrue(busy.get(body).await(5, TimeUnit.SECONDS), body + " is
not being processed");
+ }
+ }
+
+ private void release(String body) {
+ releases.computeIfAbsent(body, b -> new CountDownLatch(1)).countDown();
+ }
+
+ private SedaConsumer restartConsumer() {
+ SedaConsumer consumer = (SedaConsumer)
context.getRoute("seda").getConsumer();
+ ServiceHelper.stopService(consumer);
+ ServiceHelper.startService(consumer);
+ return consumer;
+ }
+
+ private Thread prepareShutdownInThread(SedaConsumer consumer) {
+ Thread shutdown = new Thread(() -> consumer.prepareShutdown(false,
false), "prepare-shutdown");
+ shutdown.start();
+ return shutdown;
+ }
+
+ @Test
+ void testRestartWhileBusyKeepsConcurrentConsumers() throws Exception {
+ sendAndWaitBusy("a1", "a2");
+ restartConsumer();
+ release("a1");
+ release("a2");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> active.get() == 0);
+
+ maxActive.set(0);
+ sendAndWaitBusy("b1", "b2");
+ template.sendBody("seda:foo", "b3");
+ // concurrentConsumers=2: the third exchange must wait for a free
thread
+ await().during(500, TimeUnit.MILLISECONDS).atMost(2,
TimeUnit.SECONDS).until(() -> active.get() == 2);
+ assertEquals(2, maxActive.get());
+ release("b1");
+ release("b2");
+ release("b3");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> processed.get() == 5);
+ // the threads of the first start ended after their exchange
+ await().atMost(5, TimeUnit.SECONDS).until(() ->
!threads.get("a1").isAlive() && !threads.get("a2").isAlive());
+ }
+
+ @Test
+ void testPrepareShutdownAfterRestartWaitsForTheExchangeBeingProcessed()
throws Exception {
+ sendAndWaitBusy("a1", "a2");
+ SedaConsumer consumer = restartConsumer();
+ release("a1");
+ release("a2");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> active.get() == 0);
+
+ sendAndWaitBusy("b1");
+ Thread shutdown = prepareShutdownInThread(consumer);
+ await().during(500, TimeUnit.MILLISECONDS).atMost(2, TimeUnit.SECONDS)
+ .until(() -> shutdown.isAlive() && active.get() == 1);
+ release("b1");
+ shutdown.join(5000);
+ assertFalse(shutdown.isAlive(), "prepareShutdown did not return once
the exchange was processed");
+ assertEquals(0, active.get());
+ }
+
+ @Test
+ void testPrepareShutdownWaitsForAThreadOfTheEarlierStart() throws
Exception {
+ sendAndWaitBusy("a1", "a2");
+ SedaConsumer consumer = restartConsumer();
+ // one thread of the first start ends, the other still processes the
exchange it polled before the stop
+ release("a1");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> active.get() == 1);
+
+ Thread shutdown = prepareShutdownInThread(consumer);
+ await().during(500, TimeUnit.MILLISECONDS).atMost(2, TimeUnit.SECONDS)
+ .until(() -> shutdown.isAlive() && active.get() == 1);
+ release("a2");
+ shutdown.join(5000);
+ assertFalse(shutdown.isAlive(), "prepareShutdown did not return once
the exchange was processed");
+ assertEquals(0, active.get());
+ }
+
+ @Test
+ void testThreadInterruptedByTheStopEndsAfterTheRestart() throws Exception {
+ sendAndWaitBusy("keep");
+ SedaConsumer consumer = restartConsumer();
+ // the processor returns with the interrupt flag of the stop still set
+ release("keep");
+ Thread old = threads.get("keep");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> !old.isAlive());
+
+ for (int i = 0; i < 10; i++) {
+ template.sendBody("seda:foo", "fast");
+ }
+ await().atMost(5, TimeUnit.SECONDS).until(() -> processed.get() == 11);
+
+ // nothing pending or in flight: a graceful shutdown does not wait for
its timeout (10 seconds)
+ Thread shutdown = prepareShutdownInThread(consumer);
+ shutdown.join(5000);
+ assertFalse(shutdown.isAlive(), "prepareShutdown waits for a thread
that does not end");
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ context.getShutdownStrategy().setTimeout(10);
+
from("seda:foo?concurrentConsumers=2&pollTimeout=100").routeId("seda")
+ .process(e -> {
+ String body = e.getMessage().getBody(String.class);
+ int a = active.incrementAndGet();
+ maxActive.accumulateAndGet(a, Math::max);
+ try {
+ if (!"fast".equals(body)) {
+ hold(body, "keep".equals(body));
+ }
+ } finally {
+ active.decrementAndGet();
+ processed.incrementAndGet();
+ }
+ });
+ }
+ };
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index c0a32601f4a3..d92df4db2c6a 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -385,6 +385,15 @@ when the queue is purged). Before, the producer waited for
a reply that never ca
default), and then failed with an `ExchangeTimedOutException`, or for ever
when the `timeout` was 0 or less. A discarded
`InOnly` message is still dropped without an error.
+=== camel-seda - SedaConsumer.doRun takes the start of its polling task
+
+`SedaConsumer.doRun()` is now `doRun(int start)`. Each start of the consumer
submits its own polling tasks, and a
+task stops polling once the consumer was stopped and started again, so that
the threads of an earlier start no longer
+poll next to the threads of the new start. The `taskCount` arithmetic that
`setupTasks` used to add threads on a
+restart is gone. A class that extends `SedaConsumer` and overrides `doRun()`
must override `doRun(int start)`
+instead, and should keep the loop condition `isCurrentStart(start) &&
isRunAllowed()` of the default implementation.
+The new protected method `isCurrentStart(int start)` returns true while no
later start of the consumer has happened.
+
=== camel-ehcache - shared CacheManager and changed defaults
The following user-visible changes take effect in 4.24: