You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/06/20 19:42:04 UTC

[camel] 01/03: CAMEL-18210: camel-core - Pooled exchanges in batch consumer may use an exchange concurrently

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

commit 47983c97e56a33c9ca24d61532fded68df8fd6d9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 20 20:07:32 2022 +0200

    CAMEL-18210: camel-core - Pooled exchanges in batch consumer may use an exchange concurrently
---
 .../main/java/org/apache/camel/impl/engine/DefaultUnitOfWork.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultUnitOfWork.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultUnitOfWork.java
index 36821bbfc1a..704d0d56f85 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultUnitOfWork.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultUnitOfWork.java
@@ -259,7 +259,11 @@ public class DefaultUnitOfWork implements UnitOfWork {
             // pooled exchange has its own done logic which will reset this uow for reuse
             // so do not call onDone
             try {
-                ((PooledExchange) exchange).done();
+                PooledExchange pooled = (PooledExchange) exchange;
+                // only trigger done if we should auto-release
+                if (pooled.isAutoRelease()) {
+                    ((PooledExchange) exchange).done();
+                }
             } catch (Throwable e) {
                 // must catch exceptions to ensure synchronizations is also invoked
                 log.warn("Exception occurred during exchange done. This exception will be ignored.", e);