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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4608c24  camel-core - Optimize with off uuid generator that can be 
used for memory profiling.
4608c24 is described below

commit 4608c24e50eada848b7fc5bc46cb0a9881ab243c
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sat Apr 10 16:44:42 2021 +0200

    camel-core - Optimize with off uuid generator that can be used for memory 
profiling.
---
 .../main/java/org/apache/camel/spi/UuidGenerator.java  | 11 ++++++++++-
 .../META-INF/camel-main-configuration-metadata.json    |  2 +-
 core/camel-main/src/main/docs/main.adoc                |  2 +-
 .../camel/main/DefaultConfigurationConfigurer.java     |  3 +++
 .../camel/main/DefaultConfigurationProperties.java     |  5 +++--
 .../org/apache/camel/support/AbstractExchange.java     |  2 +-
 .../org/apache/camel/support/OffUuidGenerator.java}    | 18 +++++++++---------
 7 files changed, 28 insertions(+), 15 deletions(-)

diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/UuidGenerator.java 
b/core/camel-api/src/main/java/org/apache/camel/spi/UuidGenerator.java
index 56be5ff..6d11a7a 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/UuidGenerator.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/UuidGenerator.java
@@ -22,9 +22,18 @@ package org.apache.camel.spi;
 public interface UuidGenerator {
 
     /**
-     * Generates a UUID string representation.
+     * Generates an UUID string representation.
      * 
      * @return the unique id.
      */
     String generateUuid();
+
+    /**
+     * Generates an UUID string representation to be used as exchange id.
+     *
+     * @return the unique exchange id
+     */
+    default String generateExchangeUuid() {
+        return generateUuid();
+    }
 }
diff --git 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index 8a15602..b4f38a5 100644
--- 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++ 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -101,7 +101,7 @@
     { "name": "camel.main.useBreadcrumb", "description": "Set whether 
breadcrumb is enabled. The default value is false.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.main.useDataType", "description": "Whether to enable 
using data type on Camel messages. Data type are automatic turned on if one ore 
more routes has been explicit configured with input and output types. Otherwise 
data type is default off.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.main.useMdcLogging", "description": "To turn on MDC 
logging", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", 
"type": "boolean", "javaType": "boolean", "defaultValue": "false" },
-    { "name": "camel.main.uuidGenerator", "description": "UUID generator to 
use. default (32 bytes), short (16 bytes), classic (32 bytes or longer), simple 
(long incrementing counter)", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "defaultValue": "default", "enum": [ "classic", 
"default", "short", "simple" ] },
+    { "name": "camel.main.uuidGenerator", "description": "UUID generator to 
use. default (32 bytes), short (16 bytes), classic (32 bytes or longer), simple 
(long incrementing counter), off (turned off for exchanges - only intended for 
performance profiling)", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "defaultValue": "default", "enum": [ "classic", 
"default", "short", "simple", "off" ] },
     { "name": "camel.faulttolerance.bulkheadEnabled", "description": "Whether 
bulkhead is enabled or not on the circuit breaker. Default is false.", 
"sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties", 
"type": "boolean", "javaType": "java.lang.Boolean", "defaultValue": false },
     { "name": "camel.faulttolerance.bulkheadExecutorServiceRef", 
"description": "References to a custom thread pool to use when bulkhead is 
enabled.", "sourceType": 
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.faulttolerance.bulkheadMaxConcurrentCalls", 
"description": "Configures the max amount of concurrent calls the bulkhead will 
support. Default value is 10.", "sourceType": 
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type": 
"integer", "javaType": "java.lang.Integer", "defaultValue": 10 },
diff --git a/core/camel-main/src/main/docs/main.adoc 
b/core/camel-main/src/main/docs/main.adoc
index c0797f0..0878162 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -113,7 +113,7 @@ The following table lists all the options:
 | *camel.main.useBreadcrumb* | Set whether breadcrumb is enabled. The default 
value is false. | false | boolean
 | *camel.main.useDataType* | Whether to enable using data type on Camel 
messages. Data type are automatic turned on if one ore more routes has been 
explicit configured with input and output types. Otherwise data type is default 
off. | false | boolean
 | *camel.main.useMdcLogging* | To turn on MDC logging | false | boolean
-| *camel.main.uuidGenerator* | UUID generator to use. default (32 bytes), 
short (16 bytes), classic (32 bytes or longer), simple (long incrementing 
counter) | default | String
+| *camel.main.uuidGenerator* | UUID generator to use. default (32 bytes), 
short (16 bytes), classic (32 bytes or longer), simple (long incrementing 
counter), off (turned off for exchanges - only intended for performance 
profiling) | default | String
 | *camel.faulttolerance.bulkhead{zwsp}Enabled* | Whether bulkhead is enabled 
or not on the circuit breaker. Default is false. | false | Boolean
 | *camel.faulttolerance.bulkhead{zwsp}ExecutorServiceRef* | References to a 
custom thread pool to use when bulkhead is enabled. |  | String
 | *camel.faulttolerance.bulkhead{zwsp}MaxConcurrentCalls* | Configures the max 
amount of concurrent calls the bulkhead will support. Default value is 10. | 10 
| Integer
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
index f5e1038..6b7f3bf 100644
--- 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
+++ 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
@@ -73,6 +73,7 @@ import org.apache.camel.spi.UnitOfWorkFactory;
 import org.apache.camel.spi.UuidGenerator;
 import org.apache.camel.support.ClassicUuidGenerator;
 import org.apache.camel.support.DefaultUuidGenerator;
+import org.apache.camel.support.OffUuidGenerator;
 import org.apache.camel.support.ShortUuidGenerator;
 import org.apache.camel.support.SimpleUuidGenerator;
 import org.apache.camel.support.jsse.GlobalSSLContextParametersSupplier;
@@ -205,6 +206,8 @@ public final class DefaultConfigurationConfigurer {
             camelContext.setUuidGenerator(new ClassicUuidGenerator());
         } else if ("simple".equals(config.getUuidGenerator())) {
             camelContext.setUuidGenerator(new SimpleUuidGenerator());
+        } else if ("off".equals(config.getUuidGenerator())) {
+            camelContext.setUuidGenerator(new OffUuidGenerator());
         }
 
         camelContext.setMessageHistory(config.isMessageHistory());
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
index 759ae3b..b874fb4 100644
--- 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
+++ 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
@@ -41,7 +41,7 @@ public abstract class DefaultConfigurationProperties<T> {
     private boolean inflightRepositoryBrowseEnabled;
     private String fileConfigurations;
     private boolean jmxEnabled = true;
-    @Metadata(enums = "classic,default,short,simple", defaultValue = "default")
+    @Metadata(enums = "classic,default,short,simple,off", defaultValue = 
"default")
     private String uuidGenerator = "default";
     private int producerTemplateCacheSize = 1000;
     private int consumerTemplateCacheSize = 1000;
@@ -291,7 +291,8 @@ public abstract class DefaultConfigurationProperties<T> {
     /**
      * UUID generator to use.
      *
-     * default (32 bytes), short (16 bytes), classic (32 bytes or longer), 
simple (long incrementing counter)
+     * default (32 bytes), short (16 bytes), classic (32 bytes or longer), 
simple (long incrementing counter), off
+     * (turned off for exchanges - only intended for performance profiling)
      */
     public void setUuidGenerator(String uuidGenerator) {
         this.uuidGenerator = uuidGenerator;
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java
index 37282a6..42d578d 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java
@@ -873,7 +873,7 @@ class AbstractExchange implements ExtendedExchange {
     }
 
     protected String createExchangeId() {
-        return context.getUuidGenerator().generateUuid();
+        return context.getUuidGenerator().generateExchangeUuid();
     }
 
     @Override
diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/UuidGenerator.java 
b/core/camel-support/src/main/java/org/apache/camel/support/OffUuidGenerator.java
similarity index 71%
copy from core/camel-api/src/main/java/org/apache/camel/spi/UuidGenerator.java
copy to 
core/camel-support/src/main/java/org/apache/camel/support/OffUuidGenerator.java
index 56be5ff..213f473 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/UuidGenerator.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/OffUuidGenerator.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spi;
+package org.apache.camel.support;
+
+import org.apache.camel.spi.UuidGenerator;
 
 /**
- * Generator to generate UUID strings.
+ * {@link UuidGenerator} which is turned off for exchange ids, but generated 
UUIDs for everything else.
  */
-public interface UuidGenerator {
+public class OffUuidGenerator extends DefaultUuidGenerator {
 
-    /**
-     * Generates a UUID string representation.
-     * 
-     * @return the unique id.
-     */
-    String generateUuid();
+    @Override
+    public String generateExchangeUuid() {
+        return "";
+    }
 }

Reply via email to