tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1425569 - /tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java
Date Mon, 24 Dec 2012 01:08:52 GMT
Author: markt
Date: Mon Dec 24 01:08:52 2012
New Revision: 1425569

URL: http://svn.apache.org/viewvc?rev=1425569&view=rev
Log:
Only fire the writeListener if canWrite() has been called. Note: onWritePossible() will be
called in the background until the buffer is empty.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java?rev=1425569&r1=1425568&r2=1425569&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java Mon
Dec 24 01:08:52 2012
@@ -31,6 +31,7 @@ public abstract class AbstractServletOut
 
     // Start in blocking-mode
     private volatile WriteListener listener = null;
+    private volatile boolean fireListener = false;
     private volatile byte[] buffer;
 
     @Override
@@ -40,7 +41,9 @@ public abstract class AbstractServletOut
                     sm.getString("upgrade.sos.canWrite.is"));
         }
 
-        return buffer == null;
+        boolean result = (buffer == null);
+        fireListener = !result;
+        return result;
     }
 
     @Override
@@ -106,7 +109,8 @@ public abstract class AbstractServletOut
         } catch (IOException ioe) {
             throw new RuntimeException(ioe);
         }
-        if (buffer == null) {
+        if (buffer == null && fireListener) {
+            fireListener = false;
             listener.onWritePossible();
         }
     }



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


Mime
View raw message