Layout renderer performance improvements & corrections
------------------------------------------------------

                 Key: STS-302
                 URL: http://mc4j.org/jira/browse/STS-302
             Project: Stripes
          Issue Type: Improvement
          Components: Tag Library
    Affects Versions: Release 1.4.1
            Reporter: Denis Ivaikin
         Assigned To: Tim Fennell


net.sourceforge.stripes.tag.layout.LayoutRenderTag - doEndTag() does the 
following:

URL target = request.getSession().getServletContext().getResource(this.name);

This forces servlet container to create the new session if none exists which 
might be not desirable if the page does not uses sessions at all (page 
session="false" directive). It's possible to get the servlet context through 
the getPageContext().getServletContext().

Another issue is the getResource() performance penalty, this method triggers 
check if the file exists on the local file system, which is quite slow. Since 
there are few layouts in the application, it's possible to use the Map between 
the page name & URL.

So, I've made a minor patch which allocates the static Map

private static ConcurrentMap<String, URL> targetMap = new 
ConcurrentHashMap<String, URL>();

And uses it like this

if (!targetMap.containsKey(this.name)) targetMap.put(this.name, 
getPageContext().getServletContext().getResource(this.name));
URL target = targetMap.get(this.name);

Which actually gives some performance benefit. However, some pages in the 
application might be deleted in runtime, so, this method could give the false 
positive. It could be possible to refresh the map periodically or use some kind 
of listener.

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

        

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to