You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Alan Dávila (Jira)" <ji...@apache.org> on 2023/04/26 08:26:00 UTC
[jira] [Comment Edited] (CAMEL-19295) Concurrency issues with dynamicMap in AbstractDynamicRegistry
[ https://issues.apache.org/jira/browse/CAMEL-19295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17716599#comment-17716599 ]
Alan Dávila edited comment on CAMEL-19295 at 4/26/23 8:25 AM:
--------------------------------------------------------------
Hi, yes, I have tried with version 3.20.3 and 4.0.0-M2 and the same error occurs. Creating LRUCacheFactory instance from this class serves as a stopgap solution for the tested versions.
{code:java}
public class SynchronizedLRUCacheFactory extends DefaultLRUCacheFactory {
...
@Override
public <K, V> Map<K, V> createLRUCache(int maximumCacheSize) {
return Collections.synchronizedMap(super.createLRUCache(maximumCacheSize));
}
...
}{code}
was (Author: JIRAUSER300034):
Hi, yes, I have tried with version 3.20.3 and 4.0.0-M2 and the same error occurs. Creating LRUCacheFactory instance from this class serves as a stopgap solution for the tested versions of the problem.
{code:java}
public class SynchronizedLRUCacheFactory extends DefaultLRUCacheFactory {
...
@Override
public <K, V> Map<K, V> createLRUCache(int maximumCacheSize) {
return Collections.synchronizedMap(super.createLRUCache(maximumCacheSize));
}
...
}{code}
> Concurrency issues with dynamicMap in AbstractDynamicRegistry
> -------------------------------------------------------------
>
> Key: CAMEL-19295
> URL: https://issues.apache.org/jira/browse/CAMEL-19295
> Project: Camel
> Issue Type: Bug
> Affects Versions: 3.14.2
> Reporter: Alan Dávila
> Assignee: Rhuan Rocha
> Priority: Minor
> Attachments: OOMECamelEndpointRegistry.java
>
>
> Hello everyone,
> We have detected concurrency issues related to the dynamicMap attribute of the AbstractDynamicRegistry class. By default, dynamicMap is an object of the SimpleLRUCache class, which inherits from LinkedHashMap.
> We have resolved the issue by creating our own LRUCacheFactory which returns a thread-safe synchronized map backed by the specified map.
> Could you please review it?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)