You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Nikita Dubrovsky (JIRA)" <ji...@apache.org> on 2008/06/10 20:47:45 UTC

[jira] Issue Comment Edited: (PLUTO-487) PortletPreferencesImpl should not store the preferences every time it is instantiated

    [ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603969#action_12603969 ] 

nikd edited comment on PLUTO-487 at 6/10/08 11:47 AM:
------------------------------------------------------------------

Hi Eric, sorry for the delay! The one use-case I was considering is whether the portal might expect to be able to read a portlet's preferences from the persistent store, without the portlet having ever called store() explicitly. However, I don't think this is a valid use-case, because it assumes that the portlet must have retrieved its preferences at least once (which currently would store them). So, I think it makes sense to remove the call to internalStore() from the PortletPreferencesImpl constructor. Removing the call would also be very good for efficiency and performance; for example, right now if 1000 users view the same portlet, there will be 1000 copies of the same default preferences in the persistent store, even if none of the users actually changed the portlet's preferences.

The one suggestion I have is to make internalStore() protected instead of private, so that the method can be used if someone wants to modify the behavior by extending the class.

      was (Author: nikd):
    Hi Eric, sorry for the delay! The one use-case I was considering is whether the portal might expect to be able to read a portlet's preferences from the persistent store, without the portlet having called store() explicitly. However, I don't think this is a completely valid use-case, because it assumes that the portlet must have retrieved its preferences at least once (which would store them). So, I believe it makes sense to remove the call to internalStore() from the PortletPreferencesImpl constructor. The one suggestion I have is to make internalStore() protected instead of private, so that the method can be used if someone wants to modify the behavior by extending the class.
  
> PortletPreferencesImpl should not store the preferences every time it is instantiated
> -------------------------------------------------------------------------------------
>
>                 Key: PLUTO-487
>                 URL: https://issues.apache.org/jira/browse/PLUTO-487
>             Project: Pluto
>          Issue Type: Improvement
>          Components: portlet container
>    Affects Versions: 1.1.5
>         Environment: Tomcat 5.5.26
>            Reporter: Nikita Dubrovsky
>            Assignee: Eric Dalquist
>             Fix For: 1.1.6
>
>         Attachments: P487-1.1.x-Rev656347.diff
>
>
> In Pluto 1.1.5, the constructor of org.apache.pluto.internal.impl.PortletPreferencesImpl calls internalStore() every time. It would be better to only store the preferences when it is actually necessary -- I believe this is the case only when the prefs from portlet.xml have not yet been stored:
>             ...
>             Set portletXmlPrefNames = getPreferenceNames(defaultPreferences);
>             Set persistedPrefNames = getPreferenceNames(storedPreferences);
>             if (!persistedPrefNames.containsAll(portletXmlPrefNames)) {
>                 internalStore();
>             }
>             ...
>     private Set getPreferenceNames(InternalPortletPreference[] prefs) {
>         Set prefNames = new HashSet();
>         for (int i = 0; i < prefs.length; i++) {
>           prefNames.add(prefs[i].getName());
>         }
>         return prefNames;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.