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 2017/07/05 07:28:39 UTC
[6/8] camel git commit: CAMEL-11321: Start Camel faster by letting
LRUCache warmup concurrently as that takes up 150 millis or more.
CAMEL-11321: Start Camel faster by letting LRUCache warmup concurrently as that takes up 150 millis or more.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ab0f8eb4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ab0f8eb4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ab0f8eb4
Branch: refs/heads/master
Commit: ab0f8eb4913d1ad9510b72670b9c217bf3da63bd
Parents: 95051f1
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 4 21:23:20 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jul 5 09:28:23 2017 +0200
----------------------------------------------------------------------
.../idempotent/kafka/KafkaIdempotentRepository.java | 4 +++-
.../org/apache/camel/component/rss/UpdatedDateFilter.java | 5 +++--
.../sql/stored/CallableStatementWrapperFactory.java | 9 +++++----
3 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ab0f8eb4/components/camel-kafka/src/main/java/org/apache/camel/processor/idempotent/kafka/KafkaIdempotentRepository.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/processor/idempotent/kafka/KafkaIdempotentRepository.java b/components/camel-kafka/src/main/java/org/apache/camel/processor/idempotent/kafka/KafkaIdempotentRepository.java
index dbc1474..93e6a01 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/processor/idempotent/kafka/KafkaIdempotentRepository.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/processor/idempotent/kafka/KafkaIdempotentRepository.java
@@ -35,6 +35,7 @@ import org.apache.camel.spi.IdempotentRepository;
import org.apache.camel.support.ServiceSupport;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.LRUCache;
+import org.apache.camel.util.LRUCacheFactory;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.StringHelper;
@@ -245,11 +246,12 @@ public class KafkaIdempotentRepository extends ServiceSupport implements Idempot
}
@Override
+ @SuppressWarnings("unchecked")
protected void doStart() throws Exception {
ObjectHelper.notNull(camelContext, "camelContext");
StringHelper.notEmpty(topic, "topic");
- this.cache = Collections.synchronizedMap(new LRUCache<>(maxCacheSize));
+ this.cache = LRUCacheFactory.newLRUCache(maxCacheSize);
if (consumerConfig == null) {
consumerConfig = new Properties();
http://git-wip-us.apache.org/repos/asf/camel/blob/ab0f8eb4/components/camel-rss/src/main/java/org/apache/camel/component/rss/UpdatedDateFilter.java
----------------------------------------------------------------------
diff --git a/components/camel-rss/src/main/java/org/apache/camel/component/rss/UpdatedDateFilter.java b/components/camel-rss/src/main/java/org/apache/camel/component/rss/UpdatedDateFilter.java
index 4f1b2b7..95079ca 100644
--- a/components/camel-rss/src/main/java/org/apache/camel/component/rss/UpdatedDateFilter.java
+++ b/components/camel-rss/src/main/java/org/apache/camel/component/rss/UpdatedDateFilter.java
@@ -22,7 +22,7 @@ import java.util.Map;
import com.sun.syndication.feed.synd.SyndEntry;
import org.apache.camel.component.feed.EntryFilter;
import org.apache.camel.component.feed.FeedEndpoint;
-import org.apache.camel.util.LRUCache;
+import org.apache.camel.util.LRUCacheFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,7 +35,8 @@ public class UpdatedDateFilter implements EntryFilter {
private static final Logger LOG = LoggerFactory.getLogger(UpdatedDateFilter.class);
private Date lastUpdate;
// use a LRU so we only keep the last 1000 elements to avoid growing to large
- private Map<Integer, Integer> entriesForLastUpdate = new LRUCache<Integer, Integer>(1000);
+ @SuppressWarnings("unchecked")
+ private Map<Integer, Integer> entriesForLastUpdate = LRUCacheFactory.newLRUCache(1000);
public UpdatedDateFilter(Date lastUpdate) {
this.lastUpdate = lastUpdate;
http://git-wip-us.apache.org/repos/asf/camel/blob/ab0f8eb4/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapperFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapperFactory.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapperFactory.java
index d4434f6..a9531af 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapperFactory.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapperFactory.java
@@ -18,11 +18,10 @@ package org.apache.camel.component.sql.stored;
import java.sql.SQLException;
-import org.apache.camel.CamelContext;
import org.apache.camel.component.sql.stored.template.TemplateParser;
-import org.apache.camel.spi.ClassResolver;
import org.apache.camel.support.ServiceSupport;
import org.apache.camel.util.LRUCache;
+import org.apache.camel.util.LRUCacheFactory;
import org.springframework.jdbc.core.JdbcTemplate;
/**
@@ -37,8 +36,10 @@ public class CallableStatementWrapperFactory extends ServiceSupport {
final TemplateParser templateParser;
boolean function;
- private final LRUCache<String, TemplateStoredProcedure> templateCache = new LRUCache<>(TEMPLATE_CACHE_DEFAULT_SIZE);
- private final LRUCache<String, BatchCallableStatementCreatorFactory> batchTemplateCache = new LRUCache<>(BATCH_TEMPLATE_CACHE_DEFAULT_SIZE);
+ @SuppressWarnings("unchecked")
+ private final LRUCache<String, TemplateStoredProcedure> templateCache = LRUCacheFactory.newLRUCache(TEMPLATE_CACHE_DEFAULT_SIZE);
+ @SuppressWarnings("unchecked")
+ private final LRUCache<String, BatchCallableStatementCreatorFactory> batchTemplateCache = LRUCacheFactory.newLRUCache(BATCH_TEMPLATE_CACHE_DEFAULT_SIZE);
public CallableStatementWrapperFactory(JdbcTemplate jdbcTemplate, TemplateParser templateParser, boolean function) {
this.jdbcTemplate = jdbcTemplate;