You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by gl...@apache.org on 2003/02/10 17:29:53 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java
glenn 2003/02/10 08:29:52
Modified: jasper2/src/share/org/apache/jasper Tag: tomcat_4_branch
JspCompilationContext.java
jasper2/src/share/org/apache/jasper/servlet Tag:
tomcat_4_branch JspServletWrapper.java
Log:
Fix bug 16449, JSP servlet reload thread locking double check bug.
The locking mechanism was switched between the JspCompilationContext
and the servlet/JspServletWrapper so that the JspServletWrapper can
now check a boolean. The JspCompilationContext now calls jsw.setReload()
to reset the reload flag, but that only happens within synchronized code.
Revision Changes Path
No revision
No revision
1.6.2.7 +6 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java
Index: JspCompilationContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v
retrieving revision 1.6.2.6
retrieving revision 1.6.2.7
diff -u -r1.6.2.6 -r1.6.2.7
--- JspCompilationContext.java 13 Sep 2002 19:01:18 -0000 1.6.2.6
+++ JspCompilationContext.java 10 Feb 2003 16:29:52 -0000 1.6.2.7
@@ -113,8 +113,7 @@
protected JspRuntimeContext rctxt;
protected int removed = 0;
- protected boolean reload = true;
-
+
protected URLClassLoader jspLoader;
protected URL [] outUrls = new URL[1];
protected Class servletClass;
@@ -472,7 +471,7 @@
if (jspCompiler.isOutDated()) {
try {
jspCompiler.compile();
- reload = true;
+ jsw.setReload(true);
} catch (JasperException ex) {
throw ex;
} catch (Exception ex) {
@@ -482,12 +481,6 @@
}
}
- /** True if the servlet needs loading
- */
- public boolean isReload() {
- return reload;
- }
-
// ==================== Manipulating the class ====================
public Class load()
@@ -511,7 +504,7 @@
(Constants.getString("jsp.error.unable.compile"), ex);
}
removed = 0;
- reload = false;
+ jsw.setReload(false);
return servletClass;
}
No revision
No revision
1.6.2.3 +11 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java
Index: JspServletWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -u -r1.6.2.2 -r1.6.2.3
--- JspServletWrapper.java 13 Sep 2002 19:01:19 -0000 1.6.2.2
+++ JspServletWrapper.java 10 Feb 2003 16:29:52 -0000 1.6.2.3
@@ -111,6 +111,7 @@
private ServletConfig config;
private Options options;
private boolean firstTime = true;
+ private boolean reload = true;
JspServletWrapper(ServletConfig config, Options options, String jspUri,
boolean isErrorPage, JspRuntimeContext rctxt)
@@ -130,14 +131,18 @@
return ctxt;
}
+ public void setReload(boolean reload) {
+ this.reload = reload;
+ }
+
public Servlet getServlet()
throws ServletException, IOException, FileNotFoundException
{
- if (ctxt.isReload()) {
+ if (reload) {
synchronized (this) {
// Synchronizing on jsw enables simultaneous loading
// of different pages, but not the same page.
- if (ctxt.isReload()) {
+ if (reload) {
// This is to maintain the original protocol.
destroy();
@@ -185,7 +190,7 @@
}
}
- if (ctxt.isReload()) {
+ if (reload) {
getServlet();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org