[
https://issues.apache.org/jira/browse/SLING-5708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15292816#comment-15292816
]
Ankit Agarwal edited comment on SLING-5708 at 5/23/16 5:22 AM:
---------------------------------------------------------------
[~kwin] [~cziegeler] In case user is using JSON dictionary then condition
mentioned here
https://github.com/apache/sling/blob/trunk/bundles/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java#L198
will becomes true for any change in languagerootpaths which are cached. And
this will discard complete resource bundle cache. which is different if user is
using sling:Message dictionary.
for example user has json dictionary at path
"/libs/test/i18n/de.json"
and also resource bundle for language "de" is cached so ,
"libs/test/i18n/de.json" will be in languageRootPaths.
So any change at "/libs/test/i18n/de.json" will discard complete
resourcebundleCache.
Where as in case of sling:dictionary
languageRootPath will be like "/libs/test/i18n/de"
and any change in this dictionary will have path like this
"/libs/test/i18n/de/testMessage" so condition becomes false and complete
resourcebundleCache. will not be discarded.
Can we improve this, like if condition becomes true, than check among the
cached resourceBundle to which resourceBundle this path belongs to and than
discarding that resourceBundle. and if this resourceBundle is parent of any
ResourceBundle then discard that too.
let me know your opinion on this.
Created Separate bug SLING-5741 for this.
thanks,
cc: [~amitgupt]
was (Author: anagarwa):
[~kwin] [~cziegeler] In case user is using JSON dictionary then condition
mentioned here
https://github.com/apache/sling/blob/trunk/bundles/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java#L198
will becomes true for any change in languagerootpaths which are cached. And
this will discard complete resource bundle cache. which is different if user is
using sling:Message dictionary.
for example user has json dictionary at path
"/libs/test/i18n/de.json"
and also resource bundle for language "de" is cached so ,
"libs/test/i18n/de.json" will be in languageRootPaths.
So any change at "/libs/test/i18n/de.json" will discard complete
resourcebundleCache.
Where as in case of sling:dictionary
languageRootPath will be like "/libs/test/i18n/de"
and any change in this dictionary will have path like this
"/libs/test/i18n/de/testMessage" so condition becomes false and complete
resourcebundleCache. will not be discarded.
Can we improve this, like if condition becomes true, than check among the
cached resourceBundle to which resourceBundle this path belongs to and than
discarding that resourceBundle. and if this resourceBundle is parent of any
ResourceBundle then discard that too.
let me know your opinion on this.
thanks,
cc: [~amitgupt]
> discarding ResourceBundle of all locale
> ---------------------------------------
>
> Key: SLING-5708
> URL: https://issues.apache.org/jira/browse/SLING-5708
> Project: Sling
> Issue Type: Bug
> Components: Extensions
> Reporter: Ankit Agarwal
>
> After fix for SLING-4795 was included.
> Only ResourceBundle of locale which has been changed will be discarded.
> But this works this way only if, ResourceBundle of locale which has been
> changed is already available in ResourceBundle cache.
> If ResourceBundle cache does not have ResourceBundle of locale which has been
> has been , Complete Cache is discarded. Is this a correct behaviour ?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)