tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slaur...@apache.org
Subject svn commit: r1044746 - /tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
Date Sun, 12 Dec 2010 00:10:40 GMT
Author: slaurent
Date: Sun Dec 12 00:10:39 2010
New Revision: 1044746

URL: http://svn.apache.org/viewvc?rev=1044746&view=rev
Log:
bug 50459: StandardContext.bindThread() and unbindThread() are not symmetrical and not limited
to current thread 
https://issues.apache.org/bugzilla/show_bug.cgi?id=50459

This fixes the bug that was introduced by http://svn.apache.org/viewvc?rev=1044145&view=rev
(introduced a dedicated thread when starting and stopping web applications to avoid mem leak)

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1044746&r1=1044745&r2=1044746&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Sun Dec 12 00:10:39 2010
@@ -4862,10 +4862,10 @@ public class StandardContext extends Con
                 if ((loader != null) && (loader instanceof Lifecycle))
                     ((Lifecycle) loader).start();
 
-                // Unbinding thread
+                // since the loader just started, the webapp classloader is now
+                // created by calling unbindThread and bindThread in a row, we
+                // setup the current Thread CCL to be the webapp classloader
                 unbindThread(oldCCL);
-
-                // Binding thread
                 oldCCL = bindThread();
 
                 // Initialize logger again. Other components might have used it too early,

@@ -5542,7 +5542,7 @@ public class StandardContext extends Con
                 (getLoader().getClassLoader());
         }
 
-        DirContextURLStreamHandler.bind(getResources());
+        DirContextURLStreamHandler.bindThread(getResources());
 
         if (isUseNaming()) {
             try {
@@ -5563,16 +5563,13 @@ public class StandardContext extends Con
      */
     private void unbindThread(ClassLoader oldContextClassLoader) {
 
-        Thread.currentThread().setContextClassLoader(oldContextClassLoader);
-
-        oldContextClassLoader = null;
-
         if (isUseNaming()) {
             ContextBindings.unbindThread(this, this);
         }
 
-        DirContextURLStreamHandler.unbind();
+        DirContextURLStreamHandler.unbindThread();
 
+        Thread.currentThread().setContextClassLoader(oldContextClassLoader);
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message