ASF Bugzilla – Attachment 19537 Details for
Bug 41558
Unnecessary synchronization caused by JspFactory.getDefaultFactory while servicing JSPs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to avoid invoking JspFactory.getDefaultFactory in jspService
41558.diff (text/plain), 5.85 KB, created by
Arvind Srinivasan
on 2007-02-07 06:06:56 UTC
(
hide
)
Description:
Patch to avoid invoking JspFactory.getDefaultFactory in jspService
Filename:
MIME Type:
Creator:
Arvind Srinivasan
Created:
2007-02-07 06:06:56 UTC
Size:
5.85 KB
patch
obsolete
>Index: org/apache/jasper/compiler/Generator.java >=================================================================== >--- org/apache/jasper/compiler/Generator.java (revision 504505) >+++ org/apache/jasper/compiler/Generator.java (working copy) >@@ -402,7 +402,7 @@ > } > > out.printin(VAR_EXPRESSIONFACTORY); >- out.print(" = JspFactory.getDefaultFactory().getJspApplicationContext("); >+ out.print(" = _jspxFactory.getJspApplicationContext("); > if (ctxt.isTagFile()) { > out.print("config"); > } else { >@@ -477,6 +477,9 @@ > * preamble generation) > */ > private void genPreambleStaticInitializers() throws JasperException { >+ out.printil("private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();"); >+ out.println(); >+ > // Static data for getDependants() > out.printil("private static java.util.List _jspx_dependants;"); > out.println(); >@@ -594,7 +597,6 @@ > out.println(); > > // Local variable declarations >- out.printil("JspFactory _jspxFactory = null;"); > out.printil("PageContext pageContext = null;"); > > if (pageInfo.isSession()) >@@ -624,8 +626,6 @@ > out.printil("try {"); > out.pushIndent(); > >- out.printil("_jspxFactory = JspFactory.getDefaultFactory();"); >- > out.printin("response.setContentType("); > out.print(quote(pageInfo.getContentType())); > out.println(");"); >@@ -3307,7 +3307,7 @@ > out.pushIndent(); > > out >- .printil("if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);"); >+ .printil("_jspxFactory.releasePageContext(_jspx_page_context);"); > > out.popIndent(); > out.printil("}"); >Index: org/apache/jasper/compiler/JspRuntimeContext.java >=================================================================== >--- org/apache/jasper/compiler/JspRuntimeContext.java (revision 504505) >+++ org/apache/jasper/compiler/JspRuntimeContext.java (working copy) >@@ -72,6 +72,28 @@ > static { > JspFactoryImpl factory = new JspFactoryImpl(); > SecurityClassLoad.securityClassLoad(factory.getClass().getClassLoader()); >+ if( System.getSecurityManager() != null ) { >+ String basePackage = "org.apache.jasper."; >+ try { >+ factory.getClass().getClassLoader().loadClass( basePackage + >+ "runtime.JspFactoryImpl$PrivilegedGetPageContext"); >+ factory.getClass().getClassLoader().loadClass( basePackage + >+ "runtime.JspFactoryImpl$PrivilegedReleasePageContext"); >+ factory.getClass().getClassLoader().loadClass( basePackage + >+ "runtime.JspRuntimeLibrary"); >+ factory.getClass().getClassLoader().loadClass( basePackage + >+ "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper"); >+ factory.getClass().getClassLoader().loadClass( basePackage + >+ "runtime.ServletResponseWrapperInclude"); >+ factory.getClass().getClassLoader().loadClass( basePackage + >+ "servlet.JspServletWrapper"); >+ } catch (ClassNotFoundException ex) { >+ org.apache.juli.logging.LogFactory.getLog( HttpJspBase.class ) >+ .error("Jasper JspRuntimeContext preload of class failed: " + >+ ex.getMessage(), ex); >+ } >+ } >+ > JspFactory.setDefaultFactory(factory); > } > >Index: org/apache/jasper/runtime/HttpJspBase.java >=================================================================== >--- org/apache/jasper/runtime/HttpJspBase.java (revision 504505) >+++ org/apache/jasper/runtime/HttpJspBase.java (working copy) >@@ -41,34 +41,6 @@ > > { > >- static { >- if( JspFactory.getDefaultFactory() == null ) { >- JspFactoryImpl factory = new JspFactoryImpl(); >- if( System.getSecurityManager() != null ) { >- String basePackage = "org.apache.jasper."; >- try { >- factory.getClass().getClassLoader().loadClass( basePackage + >- "runtime.JspFactoryImpl$PrivilegedGetPageContext"); >- factory.getClass().getClassLoader().loadClass( basePackage + >- "runtime.JspFactoryImpl$PrivilegedReleasePageContext"); >- factory.getClass().getClassLoader().loadClass( basePackage + >- "runtime.JspRuntimeLibrary"); >- factory.getClass().getClassLoader().loadClass( basePackage + >- "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper"); >- factory.getClass().getClassLoader().loadClass( basePackage + >- "runtime.ServletResponseWrapperInclude"); >- factory.getClass().getClassLoader().loadClass( basePackage + >- "servlet.JspServletWrapper"); >- } catch (ClassNotFoundException ex) { >- org.apache.juli.logging.LogFactory.getLog( HttpJspBase.class ) >- .error("Jasper JspRuntimeContext preload of class failed: " + >- ex.getMessage(), ex); >- } >- } >- JspFactory.setDefaultFactory(factory); >- } >- } >- > protected HttpJspBase() { > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 41558
: 19537 |
19538