tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r1356898 - /tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
Date Tue, 03 Jul 2012 20:00:41 GMT
Author: fhanik
Date: Tue Jul  3 20:00:40 2012
New Revision: 1356898

URL: http://svn.apache.org/viewvc?rev=1356898&view=rev
Log:
both timeout and complete, as with all container callbacks must be invoked with the right
context

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

Modified: tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1356898&r1=1356897&r2=1356898&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Tue Jul  3 20:00:40 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;



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


Mime
View raw message