You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by Sviatoslav Sviridov <sv...@altlinux.ru> on 2006/01/12 21:04:53 UTC
URLGeneratorImpl in ProxyPortlet
Hello,
I'm investigating WSRP4J's ProxyPortlet and there are some things seesm
strange for me.
There is following piece of code in ProxyPortlet.render() method:
synchronized (urlGenLock)
{
// update url generator
URLGenerator urlGenerator =
URLGeneratorImpl.getInstance(renderResponse, getPortletConfig());
...
consumerEnv.getURLRewriter().setURLGenerator(urlGenerator);
}
Here instance of URLGenerator retreived and propagated to consumerEnv.
URLGenerator class has static 'instance' variable which is updated with
renderResponse and returned to caller. But actual using of urlGenerator
instance is later in code, inside of portletDriver.getMarkup() call:
response = portletDriver.getMarkup(markupRequest, userID);
This call is performed outside of synchronized (urlGenLock) section.
That means that it may lead to concurrent usage of same URLGenerator
instance which has reference to PortletResponse that belong to only one
portlet.
I think in that case it's better not to cache URLGenerator instance, but
create new instance every time (but there is still possible to cache
other values like ResourceProxy URL).
--
Best Regards,
Sviatoslav Sviridov