This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-2.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.x by this push: new cf2ae69 [CAMEL-14000] Use LRUCache instead of Map when caching Services (Producers/Consumers) (#3218) cf2ae69 is described below commit cf2ae696e462ec37620ed35346fa0b56ed1f474a Author: John Poth <poth.j...@gmail.com> AuthorDate: Thu Oct 3 04:40:58 2019 +0200 [CAMEL-14000] Use LRUCache instead of Map when caching Services (Producers/Consumers) (#3218) --- .../src/main/java/org/apache/camel/impl/DefaultServicePool.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultServicePool.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultServicePool.java index fdb928e..9d85eea 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultServicePool.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultServicePool.java @@ -18,13 +18,13 @@ package org.apache.camel.impl; import java.util.ArrayList; import java.util.Collection; +import java.util.Map; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import org.apache.camel.spi.ServicePool; import org.apache.camel.support.ServiceSupport; +import org.apache.camel.util.LRUCacheFactory; import org.apache.camel.util.ServiceHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,14 +37,16 @@ import org.slf4j.LoggerFactory; @Deprecated public abstract class DefaultServicePool<Key, Service> extends ServiceSupport implements ServicePool<Key, Service> { protected final Logger log = LoggerFactory.getLogger(getClass()); - protected final ConcurrentMap<Key, BlockingQueue<Service>> pool = new ConcurrentHashMap<>(); + protected final Map<Key, BlockingQueue<Service>> pool; protected int capacity = 100; protected DefaultServicePool() { + this.pool = LRUCacheFactory.newLRUCache(capacity); } public DefaultServicePool(int capacity) { this.capacity = capacity; + this.pool = LRUCacheFactory.newLRUCache(capacity); } public int getCapacity() {