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/24 12:32:23 UTC
[camel] branch camel-4.0.x updated: CAMEL-20038: camel-core - Deprecate LRUWeakCache
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.0.x by this push:
new 80c6cfa5148 CAMEL-20038: camel-core - Deprecate LRUWeakCache
80c6cfa5148 is described below
commit 80c6cfa51489b5a5dc46e2ec373056d7616fa7ce
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 24 14:22:51 2023 +0200
CAMEL-20038: camel-core - Deprecate LRUWeakCache
---
.../main/java/org/apache/camel/impl/engine/IntrospectionSupport.java | 4 ++--
.../main/java/org/apache/camel/support/DefaultLRUCacheFactory.java | 3 +++
.../src/main/java/org/apache/camel/support/LRUCacheFactory.java | 3 +++
.../java/org/apache/camel/support/management/MBeanInfoAssembler.java | 4 ++--
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/IntrospectionSupport.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/IntrospectionSupport.java
index 4383eb2def7..efe6f95e93c 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/IntrospectionSupport.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/IntrospectionSupport.java
@@ -69,9 +69,9 @@ final class IntrospectionSupport {
private static final Logger LOG = LoggerFactory.getLogger(IntrospectionSupport.class);
private static final List<Method> EXCLUDED_METHODS = new ArrayList<>();
// use a cache to speedup introspecting for known classes during startup
- // use a weak cache as we don't want the cache to keep around as it reference classes
+ // use a soft cache as we don't want the cache to keep around as it reference classes
// which could prevent classloader to unload classes if being referenced from this cache
- private static final Map<Class<?>, BeanIntrospection.ClassInfo> CACHE = LRUCacheFactory.newLRUWeakCache(1000);
+ private static final Map<Class<?>, BeanIntrospection.ClassInfo> CACHE = LRUCacheFactory.newLRUSoftCache(1000);
private static final Pattern SECRETS = Pattern.compile(".*(passphrase|password|secretKey).*", Pattern.CASE_INSENSITIVE);
static {
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/DefaultLRUCacheFactory.java b/core/camel-support/src/main/java/org/apache/camel/support/DefaultLRUCacheFactory.java
index f52d7e60b45..d5a21b23d1b 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/DefaultLRUCacheFactory.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/DefaultLRUCacheFactory.java
@@ -129,18 +129,21 @@ public class DefaultLRUCacheFactory extends LRUCacheFactory {
* @throws IllegalArgumentException if the initial capacity is negative
*/
@Override
+ @Deprecated
public <K, V> Map<K, V> createLRUWeakCache(int maximumCacheSize) {
LOG.trace("Creating LRUWeakCache with maximumCacheSize: {}", maximumCacheSize);
return new SimpleLRUCache<>(maximumCacheSize);
}
@Override
+ @Deprecated
public <K, V> Map<K, V> createLRUWeakCache(int initialCapacity, int maximumCacheSize) {
LOG.trace("Creating LRUCache with initialCapacity: {}, maximumCacheSize: {}", initialCapacity, maximumCacheSize);
return new SimpleLRUCache<>(initialCapacity, maximumCacheSize);
}
@Override
+ @Deprecated
public <K, V> Map<K, V> createLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction) {
LOG.trace("Creating LRUCache with initialCapacity: {}, maximumCacheSize: {}, stopOnEviction: {}", initialCapacity,
maximumCacheSize, stopOnEviction);
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java b/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java
index b13ed16c83d..95b1e287387 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java
@@ -290,6 +290,7 @@ public abstract class LRUCacheFactory {
* @param maximumCacheSize the max capacity.
* @throws IllegalArgumentException if the initial capacity is negative
*/
+ @Deprecated
public abstract <K, V> Map<K, V> createLRUWeakCache(int maximumCacheSize);
/**
@@ -300,6 +301,7 @@ public abstract class LRUCacheFactory {
* @param maximumCacheSize the max capacity.
* @throws IllegalArgumentException if the initial capacity is negative
*/
+ @Deprecated
public abstract <K, V> Map<K, V> createLRUWeakCache(int initialCapacity, int maximumCacheSize);
/**
@@ -311,6 +313,7 @@ public abstract class LRUCacheFactory {
* @param stopOnEviction whether to stop service on eviction.
* @throws IllegalArgumentException if the initial capacity is negative
*/
+ @Deprecated
public abstract <K, V> Map<K, V> createLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction);
}
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/management/MBeanInfoAssembler.java b/core/camel-support/src/main/java/org/apache/camel/support/management/MBeanInfoAssembler.java
index ae28c64e642..e3b7496e1d2 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/management/MBeanInfoAssembler.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/management/MBeanInfoAssembler.java
@@ -60,7 +60,7 @@ public class MBeanInfoAssembler implements Service {
private final BeanIntrospection beanIntrospection;
// use a cache to speedup gathering JMX MBeanInfo for known classes
- // use a weak cache as we don't want the cache to keep around as it reference classes
+ // use a soft cache as we don't want the cache to keep around as it reference classes
// which could prevent classloader to unload classes if being referenced from this cache
private Map<Class<?>, MBeanAttributesAndOperations> cache;
@@ -70,7 +70,7 @@ public class MBeanInfoAssembler implements Service {
@Override
public void start() {
- cache = LRUCacheFactory.newLRUWeakCache(1000);
+ cache = LRUCacheFactory.newLRUSoftCache(1000);
}
@Override