camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/8] camel git commit: Optimise - LRUSoftCache takes time to init so create it in doStart instead
Date Wed, 05 Jul 2017 07:28:36 GMT
Optimise - LRUSoftCache takes time to init so create it in doStart instead


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f647c223
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f647c223
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f647c223

Branch: refs/heads/master
Commit: f647c22331bf4d2949c23db600e7386cb4e34b49
Parents: dcfb01a
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Jul 4 14:45:48 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 5 09:28:22 2017 +0200

----------------------------------------------------------------------
 .../apache/camel/component/bean/AbstractBeanProcessor.java   | 1 -
 .../apache/camel/impl/DefaultPackageScanClassResolver.java   | 8 +++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f647c223/camel-core/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java
b/camel-core/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java
index 02425d7..8c5d600 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/AbstractBeanProcessor.java
@@ -45,7 +45,6 @@ public abstract class AbstractBeanProcessor implements AsyncProcessor {
     private String method;
     private boolean shorthandMethod;
 
-
     public AbstractBeanProcessor(Object pojo, BeanInfo beanInfo) {
         this(new ConstantBeanHolder(pojo, beanInfo));
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/f647c223/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
b/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
index 6390e27..a9074f8 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
@@ -59,8 +59,7 @@ public class DefaultPackageScanClassResolver extends ServiceSupport implements
P
 
     protected final Logger log = LoggerFactory.getLogger(getClass());
     private final Set<ClassLoader> classLoaders = new LinkedHashSet<ClassLoader>();
-    // use a JAR cache to speed up scanning JARs, but let it be soft referenced so it can
claim the data when memory is needed
-    private final Map<String, List<String>> jarCache = new LRUSoftCache<String,
List<String>>(1000);
+    private Map<String, List<String>> jarCache;
     private Set<PackageScanFilter> scanFilters;
     private String[] acceptableSchemes = {};
 
@@ -509,7 +508,10 @@ public class DefaultPackageScanClassResolver extends ServiceSupport implements
P
     }
 
     protected void doStart() throws Exception {
-        // noop
+        if (jarCache == null) {
+            // use a JAR cache to speed up scanning JARs, but let it be soft referenced so
it can claim the data when memory is needed
+            jarCache = new LRUSoftCache<String, List<String>>(1000);
+        }
     }
 
     protected void doStop() throws Exception {


Mime
View raw message