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 2023/10/18 12:52:46 UTC

[camel] branch bean-cache updated: CAMEL-19999: camel-bean - Allow to configure bean introspection cache on component

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

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


The following commit(s) were added to refs/heads/bean-cache by this push:
     new 45360b3054d CAMEL-19999: camel-bean - Allow to configure bean introspection cache on component
45360b3054d is described below

commit 45360b3054d2a6e814e778f72642c42b5fa2b038
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Oct 18 14:52:30 2023 +0200

    CAMEL-19999: camel-bean - Allow to configure bean introspection cache on component
---
 .../generated/resources/org/apache/camel/catalog/components/bean.json | 2 +-
 .../resources/org/apache/camel/catalog/components/class.json          | 2 +-
 .../src/generated/resources/org/apache/camel/component/bean/bean.json | 2 +-
 .../resources/org/apache/camel/component/beanclass/class.json         | 2 +-
 .../src/main/java/org/apache/camel/component/bean/BeanComponent.java  | 4 ++--
 .../camel/builder/component/dsl/BeanComponentBuilderFactory.java      | 3 ++-
 .../camel/builder/component/dsl/ClasComponentBuilderFactory.java      | 3 ++-
 7 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/bean.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/bean.json
index 327d95440ca..c9abb38b12e 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/bean.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/bean.json
@@ -25,7 +25,7 @@
     "lazyStartProducer": { "index": 0, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "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 [...]
     "scope": { "index": 1, "kind": "property", "displayName": "Scope", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.BeanScope", "enum": [ "Singleton", "Request", "Prototype" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Singleton", "description": "Scope of bean. When using singleton scope (default) the bean is created or looked up only once and reused for the lifetime of the endpoint. The bean should  [...]
     "autowiredEnabled": { "index": 2, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...]
-    "beanInfoCacheSize": { "index": 3, "kind": "property", "displayName": "Bean Info Cache Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "Maximum cache size of internal cache for bean introspection." }
+    "beanInfoCacheSize": { "index": 3, "kind": "property", "displayName": "Bean Info Cache Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "Maximum cache size of internal cache for bean introspection. Setting a value of 0 or negative will disable the cache." }
   },
   "headers": {
     "CamelBeanMethodName": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the method to invoke.", "constantName": "org.apache.camel.component.bean.BeanConstants#BEAN_METHOD_NAME" }
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/class.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/class.json
index 9e37fad812e..a870e294575 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/class.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/class.json
@@ -25,7 +25,7 @@
     "lazyStartProducer": { "index": 0, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "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 [...]
     "scope": { "index": 1, "kind": "property", "displayName": "Scope", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.BeanScope", "enum": [ "Singleton", "Request", "Prototype" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Singleton", "description": "Scope of bean. When using singleton scope (default) the bean is created or looked up only once and reused for the lifetime of the endpoint. The bean should  [...]
     "autowiredEnabled": { "index": 2, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...]
-    "beanInfoCacheSize": { "index": 3, "kind": "property", "displayName": "Bean Info Cache Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "Maximum cache size of internal cache for bean introspection." }
+    "beanInfoCacheSize": { "index": 3, "kind": "property", "displayName": "Bean Info Cache Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "Maximum cache size of internal cache for bean introspection. Setting a value of 0 or negative will disable the cache." }
   },
   "headers": {
     "CamelBeanMethodName": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the method to invoke.", "constantName": "org.apache.camel.component.bean.BeanConstants#BEAN_METHOD_NAME" }
diff --git a/components/camel-bean/src/generated/resources/org/apache/camel/component/bean/bean.json b/components/camel-bean/src/generated/resources/org/apache/camel/component/bean/bean.json
index 327d95440ca..c9abb38b12e 100644
--- a/components/camel-bean/src/generated/resources/org/apache/camel/component/bean/bean.json
+++ b/components/camel-bean/src/generated/resources/org/apache/camel/component/bean/bean.json
@@ -25,7 +25,7 @@
     "lazyStartProducer": { "index": 0, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "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 [...]
     "scope": { "index": 1, "kind": "property", "displayName": "Scope", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.BeanScope", "enum": [ "Singleton", "Request", "Prototype" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Singleton", "description": "Scope of bean. When using singleton scope (default) the bean is created or looked up only once and reused for the lifetime of the endpoint. The bean should  [...]
     "autowiredEnabled": { "index": 2, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...]
-    "beanInfoCacheSize": { "index": 3, "kind": "property", "displayName": "Bean Info Cache Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "Maximum cache size of internal cache for bean introspection." }
+    "beanInfoCacheSize": { "index": 3, "kind": "property", "displayName": "Bean Info Cache Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "Maximum cache size of internal cache for bean introspection. Setting a value of 0 or negative will disable the cache." }
   },
   "headers": {
     "CamelBeanMethodName": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the method to invoke.", "constantName": "org.apache.camel.component.bean.BeanConstants#BEAN_METHOD_NAME" }
diff --git a/components/camel-bean/src/generated/resources/org/apache/camel/component/beanclass/class.json b/components/camel-bean/src/generated/resources/org/apache/camel/component/beanclass/class.json
index 9e37fad812e..a870e294575 100644
--- a/components/camel-bean/src/generated/resources/org/apache/camel/component/beanclass/class.json
+++ b/components/camel-bean/src/generated/resources/org/apache/camel/component/beanclass/class.json
@@ -25,7 +25,7 @@
     "lazyStartProducer": { "index": 0, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "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 [...]
     "scope": { "index": 1, "kind": "property", "displayName": "Scope", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.BeanScope", "enum": [ "Singleton", "Request", "Prototype" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Singleton", "description": "Scope of bean. When using singleton scope (default) the bean is created or looked up only once and reused for the lifetime of the endpoint. The bean should  [...]
     "autowiredEnabled": { "index": 2, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...]
-    "beanInfoCacheSize": { "index": 3, "kind": "property", "displayName": "Bean Info Cache Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "Maximum cache size of internal cache for bean introspection." }
+    "beanInfoCacheSize": { "index": 3, "kind": "property", "displayName": "Bean Info Cache Size", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "Maximum cache size of internal cache for bean introspection. Setting a value of 0 or negative will disable the cache." }
   },
   "headers": {
     "CamelBeanMethodName": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the method to invoke.", "constantName": "org.apache.camel.component.bean.BeanConstants#BEAN_METHOD_NAME" }
diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanComponent.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanComponent.java
index 39774e74c55..7fb4a8f1e54 100644
--- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanComponent.java
+++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanComponent.java
@@ -52,7 +52,7 @@ public class BeanComponent extends DefaultComponent {
     private BeanScope scope = BeanScope.Singleton;
 
     @Metadata(label = "advanced", defaultValue = "1000",
-              description = "Maximum cache size of internal cache for bean introspection.")
+              description = "Maximum cache size of internal cache for bean introspection. Setting a value of 0 or negative will disable the cache.")
     private int beanInfoCacheSize = 1000;
 
     public BeanComponent() {
@@ -62,7 +62,7 @@ public class BeanComponent extends DefaultComponent {
     protected void doInit() throws Exception {
         super.doInit();
 
-        if (beanInfoCache == null) {
+        if (beanInfoCache == null && beanInfoCacheSize > 0) {
             LOG.debug("Creating BeanInfo with maximum cache size: {}", beanInfoCacheSize);
             beanInfoCache = LRUCacheFactory.newLRUSoftCache(beanInfoCacheSize);
         }
diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/BeanComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/BeanComponentBuilderFactory.java
index 4fd37023b4e..bf436a19e0a 100644
--- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/BeanComponentBuilderFactory.java
+++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/BeanComponentBuilderFactory.java
@@ -121,7 +121,8 @@ public interface BeanComponentBuilderFactory {
             return this;
         }
         /**
-         * Maximum cache size of internal cache for bean introspection.
+         * Maximum cache size of internal cache for bean introspection. Setting
+         * a value of 0 or negative will disable the cache.
          * 
          * The option is a: &lt;code&gt;int&lt;/code&gt; type.
          * 
diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ClasComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ClasComponentBuilderFactory.java
index 670a82ada3e..002a7f646ff 100644
--- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ClasComponentBuilderFactory.java
+++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ClasComponentBuilderFactory.java
@@ -121,7 +121,8 @@ public interface ClasComponentBuilderFactory {
             return this;
         }
         /**
-         * Maximum cache size of internal cache for bean introspection.
+         * Maximum cache size of internal cache for bean introspection. Setting
+         * a value of 0 or negative will disable the cache.
          * 
          * The option is a: &lt;code&gt;int&lt;/code&gt; type.
          *