Author: markt
Date: Tue Feb  3 09:13:25 2015
New Revision: 1656649

URL: http://svn.apache.org/r1656649
Log:
When setting the write listener and configuring a dispatch for the first write, 
also set registeredForWrite to avoid multiple write registrations.

Modified:
    tomcat/trunk/java/org/apache/coyote/Response.java

Modified: tomcat/trunk/java/org/apache/coyote/Response.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Response.java?rev=1656649&r1=1656648&r2=1656649&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/Response.java (original)
+++ tomcat/trunk/java/org/apache/coyote/Response.java Tue Feb  3 09:13:25 2015
@@ -582,9 +582,14 @@ public final class Response {
         // written.
         if (isReady()) {
             action(ActionCode.DISPATCH_WRITE, null);
-            // Need to set the fireListener flag otherwise when the container
-            // tries to trigger onWritePossible, nothing will happen
             synchronized (nonBlockingStateLock) {
+                // Ensure we don't get multiple write registrations if
+                // ServletOutoutStream.isReady() returns false during a call to
+                // onDataAvailable()
+                registeredForWrite = true;
+                // Need to set the fireListener flag otherwise when the
+                // container tries to trigger onWritePossible, nothing will
+                // happen
                 fireListener = true;
             }
         }



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

Reply via email to