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:43:21 UTC

[camel] branch camel-3.14.x updated (f3364deebb1 -> cbf45af8f52)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


    from f3364deebb1 CAMEL-18027: camel-netty (producer) wrongly closes client channels due to request timeout being triggeted during eviction run
     new 33ff92bd5a3 CAMEL-18210: camel-core - Pooled exchanges in batch consumer may use an exchange concurrently
     new cbf45af8f52 CAMEL-18210: camel-core - Pooled exchanges in batch consumer may use an exchange concurrently

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/camel/impl/engine/DefaultUnitOfWork.java |  6 +++++-
 .../processor/BatchConsumerPooledExchangeTest.java      | 17 +++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)


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

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit cbf45af8f523869c8a47d9bac13fe9628138e677
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 20 21:36:23 2022 +0200

    CAMEL-18210: camel-core - Pooled exchanges in batch consumer may use an exchange concurrently
---
 .../processor/BatchConsumerPooledExchangeTest.java      | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/BatchConsumerPooledExchangeTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/BatchConsumerPooledExchangeTest.java
index 0c5b017e2c2..4d44889707b 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/BatchConsumerPooledExchangeTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/BatchConsumerPooledExchangeTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.processor;
 
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 
@@ -29,6 +30,7 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.engine.PooledExchangeFactory;
 import org.apache.camel.impl.engine.PooledProcessorExchangeFactory;
 import org.apache.camel.spi.PooledObjectFactory;
+import org.awaitility.Awaitility;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -43,6 +45,7 @@ public class BatchConsumerPooledExchangeTest extends ContextTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         ExtendedCamelContext ecc = (ExtendedCamelContext) super.createCamelContext();
+
         ecc.setExchangeFactory(new PooledExchangeFactory());
         ecc.setProcessorExchangeFactory(new PooledProcessorExchangeFactory());
         ecc.getExchangeFactory().setStatisticsEnabled(true);
@@ -74,12 +77,14 @@ public class BatchConsumerPooledExchangeTest extends ContextTestSupport {
 
         assertMockEndpointsSatisfied();
 
-        PooledObjectFactory.Statistics stat
-                = context.adapt(ExtendedCamelContext.class).getExchangeFactoryManager().getStatistics();
-        assertEquals(1, stat.getCreatedCounter());
-        assertEquals(2, stat.getAcquiredCounter());
-        assertEquals(3, stat.getReleasedCounter());
-        assertEquals(0, stat.getDiscardedCounter());
+        Awaitility.waitAtMost(2, TimeUnit.SECONDS).untilAsserted(() -> {
+            PooledObjectFactory.Statistics stat
+                    = context.adapt(ExtendedCamelContext.class).getExchangeFactoryManager().getStatistics();
+            assertEquals(1, stat.getCreatedCounter());
+            assertEquals(2, stat.getAcquiredCounter());
+            assertEquals(3, stat.getReleasedCounter());
+            assertEquals(0, stat.getDiscardedCounter());
+        });
     }
 
     @Override


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

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 33ff92bd5a367200a14f3dab42a3723058563447
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);