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 some 
SimpleLRUCache's method. 
   
   
https://github.com/apache/camel/blob/277887dde9ccb87d595fade27ec48c40228746a4/core/camel-support/src/main/java/org/apache/camel/support/DefaultLRUCacheFactory.java#L168



##########
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 some 
SimpleLRUCache's methods. 
   
   
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-unsubscr...@camel.apache.org

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

Reply via email to