Actually method getAllPortalNames() is called like 4 times (accurately 2*countOfPortals times) during rendering of UIUserToolbarSitePortlet. See code in UIUserToolbarSitePortlet.gtmpl:
This could mean problems like:
- Performance - There is overhead as method is unnecessarily called 4 (or more) times. Actually the overhead shouldn't be too big as portal names are cached thanks to PortalNamesCache class, but still it is.
- Consistency - For example if another client removes portal concurrently in the meantime, we can potentially see consistency issues and problems like ArrayIndexOutOfBoundException could happen
It should be improved to call getAllPortalNames only once: