[ 
https://issues.apache.org/jira/browse/SLING-2048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Munteanu closed SLING-2048.
----------------------------------

> Use ConcurrentHashMap to cache the ResourceBundle instances
> -----------------------------------------------------------
>
>                 Key: SLING-2048
>                 URL: https://issues.apache.org/jira/browse/SLING-2048
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>    Affects Versions: I18n 2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: I18n 2.1.0
>
>
> The JcrResourceBundleProvider class internally caches the JcrResourceBundle 
> instances created for later reuse. This is done in
>     Map<String, Map<Locale, ResourceBundle>>
> where regular HashMaps are used. Thus access must be properly synchronized to 
> prevent concurrency issues.
> This can be simplified (and made more performing) by using a single
>    ConcurrentHashMap<Key, ResourceBundle>
> where Key is a new Object encompassing the base name and the Locale provided 
> to the ResourceBundleProvider.
> This removes the requirement for explicit synchronization and makes the code 
> much more readably (at the expense of introducing a key class where the 
> hashCode() and equals() method have to be implemented).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to