[ 
https://jira.nuxeo.org/browse/NXP-4774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=70163#action_70163
 ] 

Sun Tan commented on NXP-4774:
------------------------------

There is a bug in the code:
     protected DocumentModel putIfAbsent(String id, DocumentModel doc) {
         if (!cache.containsKey(id)) {
             cache.put(id, doc);
         }
         return cache.get(id);
     }

Everywhere (as it was previously using putIfAbsent from ConcurrentHashMap), 
it's expected to get null if no previous value for the key. So it should be
     protected DocumentModel putIfAbsent(String id, DocumentModel doc) {
         if (!cache.containsKey(id)) {
             return cache.put(id, doc);
         }
         return cache.get(id);
     }

(Map#put return null if no previous value)

> client cache should be soft
> ---------------------------
>
>                 Key: NXP-4774
>                 URL: https://jira.nuxeo.org/browse/NXP-4774
>             Project: Nuxeo Enterprise Platform
>          Issue Type: Bug
>    Affects Versions: 5.3.x
>            Reporter: Stéphane Lacoin
>            Assignee: Stéphane Lacoin
>             Fix For: 5.3.1
>
>         Attachments: nuxeo-core-api-rcache.patch
>
>   Original Estimate: 0 minutes
>  Remaining Estimate: 0 minutes
>
> See attached patch, we could use a soft cache instead of the default one. 
> This will improve memory management on client side.
> Instead of a SoftMap, we should use a ReferenceMap that is included in apache 
> commons-collection and already distributed in nuxeo.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets

Reply via email to