You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/07/04 22:38:41 UTC
svn commit: r960392 - in /tomcat/trunk:
java/org/apache/catalina/core/AsyncContextImpl.java
webapps/docs/changelog.xml
Author: markt
Date: Sun Jul 4 20:38:41 2010
New Revision: 960392
URL: http://svn.apache.org/viewvc?rev=960392&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49528
AsyncContext.start() uses an internal dispatch but this should not have the same side-effects as calling dispatch()
TCK and test cases passes with this patch
Modified:
tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
tomcat/trunk/webapps/docs/changelog.xml
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=960392&r1=960391&r2=960392&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Sun Jul 4 20:38:41 2010
@@ -48,7 +48,8 @@ import org.apache.juli.logging.LogFactor
public class AsyncContextImpl implements AsyncContext {
public static enum AsyncState {
- NOT_STARTED, STARTED, DISPATCHING, DISPATCHED, COMPLETING, TIMING_OUT, ERROR_DISPATCHING
+ NOT_STARTED, STARTED, DISPATCHING, DISPATCHING_INTERNAL, DISPATCHED,
+ COMPLETING, TIMING_OUT, ERROR_DISPATCHING
}
private static final Log log = LogFactory.getLog(AsyncContextImpl.class);
@@ -178,8 +179,8 @@ public class AsyncContextImpl implements
log.debug("AsyncContext Start Called["+state.get()+"; "+request.getRequestURI()+"?"+request.getQueryString()+"]", new DebugException());
}
- if (state.compareAndSet(AsyncState.STARTED, AsyncState.DISPATCHING) ||
- state.compareAndSet(AsyncState.DISPATCHED, AsyncState.DISPATCHING)) {
+ if (state.compareAndSet(AsyncState.STARTED, AsyncState.DISPATCHING_INTERNAL) ||
+ state.compareAndSet(AsyncState.DISPATCHED, AsyncState.DISPATCHING_INTERNAL)) {
// TODO SERVLET3 - async
final ServletContext sctx = getServletRequest().getServletContext();
Runnable r = new Runnable() {
@@ -333,6 +334,20 @@ public class AsyncContextImpl implements
dispatch = null;
}
}
+ } else if (this.state.get() == AsyncState.DISPATCHING_INTERNAL) {
+ if (this.dispatch!=null) {
+ try {
+ dispatch.run();
+ } catch (RuntimeException x) {
+ doInternalComplete(true);
+ if (x.getCause() instanceof ServletException) throw (ServletException)x.getCause();
+ if (x.getCause() instanceof IOException) throw (IOException)x.getCause();
+ else throw new ServletException(x);
+ } finally {
+ dispatch = null;
+ this.state.set(AsyncState.DISPATCHED);
+ }
+ }
} else if (this.state.get()==AsyncState.COMPLETING) {
doInternalComplete(false);
} else {
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=960392&r1=960391&r2=960392&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Sun Jul 4 20:38:41 2010
@@ -84,6 +84,13 @@
rather than an empty string. (markt)
</fix>
<fix>
+ <bug>49528</bug>: Ensure AsyncContext.isAsyncStarted() returns the
+ correct value after AsyncContext.start(). Tomcat implements this
+ using an internal dispatch that requires slightly different treatment
+ from a standard dispatch to ensure the correct value is returned.
+ (markt)
+ </fix>
+ <fix>
<bug>49530</bug>: Contexts and Servlets not stopped when Tomcat is shut
down. (markt)
</fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org