You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "rhuan080 (via GitHub)" <gi...@apache.org> on 2023/05/23 13:57:54 UTC

[GitHub] [camel] rhuan080 commented on a diff in pull request #10157: CAMEL-19295: Experiment with sync LRUCache and test case that otherwi…

rhuan080 commented on code in PR #10157:
URL: https://github.com/apache/camel/pull/10157#discussion_r1202384980


##########
core/camel-support/src/main/java/org/apache/camel/support/DefaultLRUCacheFactory.java:
##########
@@ -53,7 +54,7 @@ public <K, V> Map<K, V> createLRUCache(int maximumCacheSize) {
     @Override
     public <K, V> Map<K, V> createLRUCache(int maximumCacheSize, Consumer<V> onEvict) {
         LOG.trace("Creating LRUCache with maximumCacheSize: {}", maximumCacheSize);
-        return new SimpleLRUCache<>(16, maximumCacheSize, onEvict);
+        return Collections.synchronizedMap(new SimpleLRUCache<>(16, maximumCacheSize, onEvict));

Review Comment:
   I think it can impact code casting to SimpleLRUCache to use methods from SimpleLRUCache. 
   
   https://github.com/apache/camel/blob/277887dde9ccb87d595fade27ec48c40228746a4/core/camel-support/src/main/java/org/apache/camel/support/DefaultLRUCacheFactory.java#L168



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org