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

commit 466f441b7bdf71768c50aff92b4ee353941be80c
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Feb 20 17:34:56 2021 +0100

    CAMEL-16222: PooledExchangeFactory experiment
---
 .../apache/camel/catalog/main/camel-main-configuration-metadata.json  | 2 ++
 .../main/java/org/apache/camel/impl/engine/SimpleCamelContext.java    | 4 +---
 docs/components/modules/others/pages/main.adoc                        | 2 ++
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index d443467..076f94a 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -33,6 +33,8 @@
     { "name": "camel.main.endpointBridgeErrorHandler", "description": "Allows 
for bridging the consumer to the Camel routing Error Handler, which mean any 
exceptions occurred while the consumer is trying to pickup incoming messages, 
or the likes, will now be processed as a message and handled by the routing 
Error Handler. By default the consumer will use the 
org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be 
logged at WARN\/ERROR level and ignored. The default va [...]
     { "name": "camel.main.endpointLazyStartProducer", "description": "Whether 
the producer should be started lazy (on the first message). By starting lazy 
you can use this to allow CamelContext and routes to startup in situations 
where a producer may otherwise fail during starting and cause the route to fail 
being started. By deferring this startup to be lazy then the startup failure 
can be handled during routing messages via Camel's routing error handlers. 
Beware that when the first mes [...]
     { "name": "camel.main.endpointRuntimeStatisticsEnabled", "description": 
"Sets whether endpoint runtime statistics is enabled (gathers runtime usage of 
each incoming and outgoing endpoints). The default value is false.", 
"sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": 
"boolean", "javaType": "boolean" },
+    { "name": "camel.main.exchangeFactory", "description": "Experimental: 
Controls whether to pool (reuse) exchanges or create new fresh exchanges 
(default). Using pooled will reduce JVM garbage collection overhead by avoiding 
to re-create Exchange instances per message each consumer receives.", 
"sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": 
"string", "javaType": "java.lang.String", "defaultValue": "default", "enum": [ 
"default", "pooled" ] },
+    { "name": "camel.main.exchangeFactoryStatisticsEnabled", "description": 
"Configures whether statistics is enabled on exchange factory.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean" },
     { "name": "camel.main.fileConfigurations", "description": "Directory to 
load additional configuration files that contains configuration values that 
takes precedence over any other configuration. This can be used to refer to 
files that may have secret configuration that has been mounted on the file 
system for containers. You can specify a pattern to load from sub directories 
and a name pattern such as \/var\/app\/secret\/.properties, multiple 
directories can be separated by comma.", " [...]
     { "name": "camel.main.inflightRepositoryBrowseEnabled", "description": 
"Sets whether the inflight repository should allow browsing each inflight 
exchange. This is by default disabled as there is a very slight performance 
overhead when enabled.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean" },
     { "name": "camel.main.javaRoutesExcludePattern", "description": "Used for 
exclusive filtering RouteBuilder classes which are collected from the registry 
or via classpath scanning. The exclusive filtering takes precedence over 
inclusive filtering. The pattern is using Ant-path style pattern. Multiple 
patterns can be specified separated by comma. For example to exclude all 
classes starting with Bar use: &#42;&#42;\/Bar&#42; To exclude all routes form 
a specific package use: com\/mycomp [...]
diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/SimpleCamelContext.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/SimpleCamelContext.java
index a9d1e87..2ec85fa 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/SimpleCamelContext.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/SimpleCamelContext.java
@@ -551,9 +551,7 @@ public class SimpleCamelContext extends 
AbstractCamelContext {
                 ExchangeFactory.FACTORY,
                 ExchangeFactory.class);
 
-        // TODO: experiment
-        //                return result.orElseGet(DefaultExchangeFactory::new);
-        return result.orElseGet(PooledExchangeFactory::new);
+     return result.orElseGet(DefaultExchangeFactory::new);
     }
 
     @Override
diff --git a/docs/components/modules/others/pages/main.adoc 
b/docs/components/modules/others/pages/main.adoc
index c7959f8..1292e86 100644
--- a/docs/components/modules/others/pages/main.adoc
+++ b/docs/components/modules/others/pages/main.adoc
@@ -47,6 +47,8 @@ The following table lists all the options:
 | *camel.main.endpointBridgeError{zwsp}Handler* | Allows for bridging the 
consumer to the Camel routing Error Handler, which mean any exceptions occurred 
while the consumer is trying to pickup incoming messages, or the likes, will 
now be processed as a message and handled by the routing Error Handler. By 
default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal 
with exceptions, that will be logged at WARN/ERROR level and ignored. The 
default value is false. |  | boolean
 | *camel.main.endpointLazyStart{zwsp}Producer* | Whether the producer should 
be started lazy (on the first message). By starting lazy you can use this to 
allow CamelContext and routes to startup in situations where a producer may 
otherwise fail during starting and cause the route to fail being started. By 
deferring this startup to be lazy then the startup failure can be handled 
during routing messages via Camel's routing error handlers. Beware that when 
the first message is processed the [...]
 | *camel.main.endpointRuntime{zwsp}StatisticsEnabled* | Sets whether endpoint 
runtime statistics is enabled (gathers runtime usage of each incoming and 
outgoing endpoints). The default value is false. |  | boolean
+| *camel.main.exchangeFactory* | Experimental: Controls whether to pool 
(reuse) exchanges or create new fresh exchanges (default). Using pooled will 
reduce JVM garbage collection overhead by avoiding to re-create Exchange 
instances per message each consumer receives. | default | String
+| *camel.main.exchangeFactory{zwsp}StatisticsEnabled* | Configures whether 
statistics is enabled on exchange factory. |  | boolean
 | *camel.main.fileConfigurations* | Directory to load additional configuration 
files that contains configuration values that takes precedence over any other 
configuration. This can be used to refer to files that may have secret 
configuration that has been mounted on the file system for containers. You can 
specify a pattern to load from sub directories and a name pattern such as 
/var/app/secret/.properties, multiple directories can be separated by comma. |  
| String
 | *camel.main.inflightRepository{zwsp}BrowseEnabled* | Sets whether the 
inflight repository should allow browsing each inflight exchange. This is by 
default disabled as there is a very slight performance overhead when enabled. | 
 | boolean
 | *camel.main.javaRoutesExclude{zwsp}Pattern* | Used for exclusive filtering 
RouteBuilder classes which are collected from the registry or via classpath 
scanning. The exclusive filtering takes precedence over inclusive filtering. 
The pattern is using Ant-path style pattern. Multiple patterns can be specified 
separated by comma. For example to exclude all classes starting with Bar use: 
&#42;&#42;/Bar&#42; To exclude all routes form a specific package use: 
com/mycompany/bar/&#42; To exclud [...]

Reply via email to