Bug 41558 - Unnecessary synchronization caused by JspFactory.getDefaultFactory while servicing JSPs
Unnecessary synchronization caused by JspFactory.getDefaultFactory while serv...
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Jasper
unspecified
All Solaris
: P4 enhancement (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2007-02-07 06:03 UTC by Arvind Srinivasan
Modified: 2007-02-07 14:55 UTC (History)
0 users



Attachments
Patch to avoid invoking JspFactory.getDefaultFactory in jspService (5.85 KB, patch)
2007-02-07 06:06 UTC, Arvind Srinivasan
Details | Diff
Difference in the generated code for hello_jsp.java before and after the patch (1.80 KB, text/plain)
2007-02-07 06:08 UTC, Arvind Srinivasan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arvind Srinivasan 2007-02-07 06:03:18 UTC
Tomcat version: 6.0.x trunk

Every generated JSP has 

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html");

in its _jspService method.

The use of JspFactory.getDefaultFactory during request processing should be
avoided as it is a *static synchronized* method.

I have a diff that addresses this and will attach it to this bug.
Comment 1 Arvind Srinivasan 2007-02-07 06:06:56 UTC
Created attachment 19537 [details]
Patch to avoid invoking JspFactory.getDefaultFactory in jspService

The attached patch changes the .jsp-->.java generator so that
JspFactory.getDefaultFactory is invoked as a one-time operation.

The patch also consolidates JspFactory initialization in JspRuntimeContext.
Comment 2 Arvind Srinivasan 2007-02-07 06:08:14 UTC
Created attachment 19538 [details]
Difference in the generated code for hello_jsp.java before and after the patch
Comment 3 Remy Maucherat 2007-02-07 14:55:20 UTC
I did not realize this method was synchronized, so thanks for mentioning it.
There doesn't seem to be any reason for that.