Hi Rainer,

source of AsyncContextImpl has a lot of open checkstyle warnings. I check my eclipse
but all formatter use space instead tabs. Very strange...

Peter

Am 04.07.2010 um 01:17 schrieb Rainer Jung:

Hi Peter,

On 04.07.2010 00:48, p...@apache.org wrote:
Author: pero
Date: Sat Jul  3 22:48:16 2010
New Revision: 960283

URL: http://svn.apache.org/viewvc?rev=960283&view=rev
Log:
Fix Bug 49528 - HttpServletRequest.isAsyncStarted() returns false when a Runnable is started
Add isDebugEnabled statements.

Todo: Why we doesn't start directly a container thread with asyncContext.start()?
Currently we start user runnable as an internal forward.

Added:
tomcat/trunk/test/org/apache/catalina/core/ TestAsyncContextImpl.java (with props)
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=960283&r1=960282&r2=960283&view=diff
= = = = = = = = = ===================================================================== --- tomcat/trunk/java/org/apache/catalina/core/ AsyncContextImpl.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/ AsyncContextImpl.java Sat Jul 3 22:48:16 2010
@@ -253,7 +253,7 @@ public class AsyncContextImpl implements
     }

     public boolean isStarted() {
- return (state.get() == AsyncState.STARTED || state.get() == AsyncState.DISPATCHING); + return (state.get() == AsyncState.STARTED || state.get() == AsyncState.DISPATCHING || state.get() == AsyncState.DISPATCHED);
     }

     public void setStarted(Context context) {
@@ -292,7 +292,8 @@ public class AsyncContextImpl implements

public void doInternalDispatch() throws ServletException, IOException { if (this.state.compareAndSet(AsyncState.TIMING_OUT, AsyncState.COMPLETING)) {
-            log.debug("TIMING OUT!");
+               if( log.isDebugEnabled())
+                   log.debug("TIMING OUT!");

Style nitpicks:

- indentation wrong, maybe tabs involved
- spacing around "if"

             boolean listenerInvoked = false;
             for (AsyncListenerWrapper listener : listeners) {
                 listener.fireOnTimeout(event);
@@ -303,15 +304,18 @@ public class AsyncContextImpl implements
             }
             doInternalComplete(true);
} else if (this.state.compareAndSet(AsyncState.ERROR_DISPATCHING, AsyncState.COMPLETING)) {
-            log.debug("ON ERROR!");
+            if( log.isDebugEnabled())
+                log.debug("ON ERROR!");

- spacing around "if"

             boolean listenerInvoked = false;
             for (AsyncListenerWrapper listener : listeners) {
                 try {
                     listener.fireOnError(event);
                 }catch (IllegalStateException x) {
-                    log.debug("Listener invoked invalid state.",x);
+                    if( log.isDebugEnabled())
+ log.debug("Listener invoked invalid state.",x);

- spacing around "if"

                 }catch (Exception x) {
-                    log.debug("Exception during onError.",x);
+                    if(log.isDebugEnabled())
+                        log.debug("Exception during onError.",x);

- spacing around "if"

                 }
                 listenerInvoked = true;
             }

Added: tomcat/trunk/test/org/apache/catalina/core/ TestAsyncContextImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java?rev=960283&view=auto
= = = = = = = = = ===================================================================== --- tomcat/trunk/test/org/apache/catalina/core/ TestAsyncContextImpl.java (added) +++ tomcat/trunk/test/org/apache/catalina/core/ TestAsyncContextImpl.java Sat Jul 3 22:48:16 2010

+    private BUG49528Servlet createTestApp(Tomcat tomcat) {
+        // Must have a real docBase - just use temp
+ File docBase = new File(System.getProperty("java.io.tmpdir"));
+
+        // Create the folder that will trigger the redirect
+        File foo = new File(docBase, "async");
+        if (!foo.exists()&&  !foo.mkdirs()) {

- spacing around "&&"

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=960283&r1=960282&r2=960283&view=diff
= = = = = = = = = =====================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Sat Jul  3 22:48:16 2010
@@ -38,6 +38,10 @@
   <subsection name="Catalina">
     <changelog>
       <fix>
+<bug>49528</bug>: HttpServletRequest.isAsyncStarted() now returns true when a Runnable is started!
+        Reported by Pieter Libin (pero)
+</fix>
+<fix>

- indentation
- no need for exclamation mark

Regards,

Rainer

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




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

Reply via email to