Author: markt
Date: Wed Jan  5 14:18:05 2011
New Revision: 1055465

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

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1055465&r1=1055464&r2=1055465&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Jan  5 14:18:05 2011
@@ -243,13 +243,6 @@ PATCHES PROPOSED TO BACKPORT:
   +1: markt, jfclere
   -1:
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50459 
-  StandardContext.bindThread() and unbindThread() are not symmetrical and not 
-  limited to current thread
-  
http://people.apache.org/~slaurent/patches/2010-12-12_BZ50459_bindThread_tc6.patch
-  +1: slaurent, kkolinko, kfujino
-  -1:
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48822
   Include context name in reload and stop log statements.
   
http://people.apache.org/~slaurent/patches/2010-12-16_BZ48822_context_name_on_reload-tc6.patch

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1055465&r1=1055464&r2=1055465&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java Wed 
Jan  5 14:18:05 2011
@@ -4540,10 +4540,11 @@ public class StandardContext
                 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, 
@@ -5062,7 +5063,7 @@ public class StandardContext
                 (getLoader().getClassLoader());
         }
 
-        DirContextURLStreamHandler.bind(getResources());
+        DirContextURLStreamHandler.bindThread(getResources());
 
         if (isUseNaming()) {
             try {
@@ -5083,16 +5084,13 @@ public class StandardContext
      */
     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);
     }
 
 

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1055465&r1=1055464&r2=1055465&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Jan  5 14:18:05 2011
@@ -183,6 +183,10 @@
         robust against objects with <code>toString()</code> methods that throw
         exceptions. (markt)
       </add>
+      <fix>
+        <bug>50459</bug>: Fix thread/classloader binding issues in
+        StandardContext. (slaurent) 
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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

Reply via email to