CAMEL-10677: And use submit for the consumer task as it should not risk using the starter thread which execute can do.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5eb6868f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5eb6868f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5eb6868f Branch: refs/heads/camel-2.18.x Commit: 5eb6868f62dfb7eadfeb85ccb77f9d02e70fd606 Parents: 28f4bfe Author: Claus Ibsen <davscl...@apache.org> Authored: Mon Jan 9 14:00:38 2017 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon Jan 9 14:00:38 2017 +0100 ---------------------------------------------------------------------- .../org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5eb6868f/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java index 243c2b8..b17cba7 100644 --- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java +++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java @@ -74,7 +74,7 @@ public class SjmsBatchConsumer extends DefaultConsumer { private ExecutorService jmsConsumerExecutors; private final AtomicBoolean running = new AtomicBoolean(true); private final AtomicReference<CountDownLatch> consumersShutdownLatchRef = new AtomicReference<>(); - private Connection connection; + private volatile Connection connection; public SjmsBatchConsumer(SjmsBatchEndpoint sjmsBatchEndpoint, Processor processor) { super(sjmsBatchEndpoint, processor); @@ -144,7 +144,7 @@ public class SjmsBatchConsumer extends DefaultConsumer { for (int i = 0; i < consumerCount; i++) { BatchConsumptionLoop loop = new BatchConsumptionLoop(); triggers.add(loop.getCompletionTimeoutTrigger()); - jmsConsumerExecutors.execute(loop); + jmsConsumerExecutors.submit(loop); } if (completionInterval > 0) {