tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1408150 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/AsyncContextImpl.java webapps/docs/changelog.xml
Date Sun, 11 Nov 2012 23:32:44 GMT
Author: markt
Date: Sun Nov 11 23:32:43 2012
New Revision: 1408150

URL: http://svn.apache.org/viewvc?rev=1408150&view=rev
Log:
both timeout and complete, as with all container callbacks must be invoked with the right
context
Backport of fhanik's r1356898

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1356898

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1408150&r1=1408149&r2=1408150&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Sun Nov 11 23:32:43
2012
@@ -110,21 +110,30 @@ public class AsyncContextImpl implements
         request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result);
         
         if (result.get()) {
-            boolean listenerInvoked = false;
-            List<AsyncListenerWrapper> listenersCopy =
-                new ArrayList<AsyncListenerWrapper>();
-            listenersCopy.addAll(listeners);
-            for (AsyncListenerWrapper listener : listenersCopy) {
-                listener.fireOnTimeout(event);
-                listenerInvoked = true;
-            }
-            if (listenerInvoked) {
-                request.getCoyoteRequest().action(
-                        ActionCode.ASYNC_IS_TIMINGOUT, result);
-                return !result.get();
-            } else {
-                // No listeners, container calls complete
-                complete();
+
+            ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+            ClassLoader newCL = request.getContext().getLoader().getClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(newCL);
+                boolean listenerInvoked = false;
+                List<AsyncListenerWrapper> listenersCopy =
+                    new ArrayList<AsyncListenerWrapper>();
+                listenersCopy.addAll(listeners);
+                for (AsyncListenerWrapper listener : listenersCopy) {
+                    listener.fireOnTimeout(event);
+                    listenerInvoked = true;
+                }
+                if (listenerInvoked) {
+                    request.getCoyoteRequest().action(
+                            ActionCode.ASYNC_IS_TIMINGOUT, result);
+                    return !result.get();
+                } else {
+                    // No listeners, container calls complete
+                    complete();
+                }
+
+            } finally {
+                Thread.currentThread().setContextClassLoader(oldCL);
             }
         }
         return true;

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1408150&r1=1408149&r2=1408150&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sun Nov 11 23:32:43 2012
@@ -118,6 +118,11 @@
         In FormAuthenticator: If it is configured to change Session IDs,
         do the change before displaying the login form. (kkolinko)
       </fix>
+      <fix>
+        Ensure <code>AsyncListener.timeout()</code> and
+        <code>AsyncListener.complete()</code> are called with the correct
+        thread context class loader. (fhanik)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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


Mime
View raw message