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

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


The following commit(s) were added to refs/heads/exchange-factory by this push:
     new 049fbe9  CAMEL-16222: PooledExchangeFactory experiment
049fbe9 is described below

commit 049fbe971fbd882c2b35ab8573944ff765284df6
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Feb 24 09:42:37 2021 +0100

    CAMEL-16222: PooledExchangeFactory experiment
---
 .../java/org/apache/camel/impl/engine/PooledExchangeFactory.java | 5 +++--
 .../src/main/java/org/apache/camel/support/DefaultConsumer.java  | 9 +++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledExchangeFactory.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledExchangeFactory.java
index 574ac36..dcd0a03 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledExchangeFactory.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledExchangeFactory.java
@@ -59,10 +59,11 @@ public final class PooledExchangeFactory extends 
ServiceSupport
         this.consumer = null;
     }
 
-    private PooledExchangeFactory(Consumer consumer, CamelContext 
camelContext, boolean statisticsEnabled) {
+    private PooledExchangeFactory(Consumer consumer, CamelContext 
camelContext, boolean statisticsEnabled, int capacity) {
         this.consumer = consumer;
         this.camelContext = camelContext;
         this.statisticsEnabled = statisticsEnabled;
+        this.capacity = capacity;
     }
 
     @Override
@@ -82,7 +83,7 @@ public final class PooledExchangeFactory extends 
ServiceSupport
 
     @Override
     public ExchangeFactory newExchangeFactory(Consumer consumer) {
-        return new PooledExchangeFactory(consumer, camelContext, 
statisticsEnabled);
+        return new PooledExchangeFactory(consumer, camelContext, 
statisticsEnabled, capacity);
     }
 
     public int getCapacity() {
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultConsumer.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultConsumer.java
index 1a07341..f27f56a 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultConsumer.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultConsumer.java
@@ -26,6 +26,7 @@ import org.apache.camel.PooledExchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.RouteAware;
+import org.apache.camel.Service;
 import org.apache.camel.spi.ExceptionHandler;
 import org.apache.camel.spi.ExchangeFactory;
 import org.apache.camel.spi.RouteIdAware;
@@ -171,6 +172,14 @@ public class DefaultConsumer extends ServiceSupport 
implements Consumer, RouteAw
     }
 
     @Override
+    protected void doBuild() throws Exception {
+        super.doBuild();
+        if (exchangeFactory instanceof Service) {
+            ((Service) exchangeFactory).build();
+        }
+    }
+
+    @Override
     protected void doInit() throws Exception {
         LOG.debug("Init consumer: {}", this);
         ServiceHelper.initService(exchangeFactory, processor);

Reply via email to