tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1478063 - in /tomcat/trunk/java/org/apache/coyote/http11: AbstractOutputBuffer.java InternalAprOutputBuffer.java InternalNioOutputBuffer.java InternalOutputBuffer.java
Date Wed, 01 May 2013 15:57:40 GMT
Author: markt
Date: Wed May  1 15:57:40 2013
New Revision: 1478063

URL: http://svn.apache.org/r1478063
Log:
Wire in flushBuffer()

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java?rev=1478063&r1=1478062&r2=1478063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java Wed May  1 15:57:40
2013
@@ -573,6 +573,7 @@ public abstract class AbstractOutputBuff
 
     protected abstract boolean hasDataToWrite();
     protected abstract void setBlocking(boolean blocking);
+    protected abstract boolean isBlocking();
 
     /**
      * Writes any remaining buffered data.

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1478063&r1=1478062&r2=1478063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Wed May  1 15:57:40
2013
@@ -106,7 +106,7 @@ public class InternalAprOutputBuffer ext
         super.flush();
 
         // Flush the current buffer
-        flushBuffer();
+        flushBuffer(isBlocking());
     }
 
 
@@ -147,7 +147,7 @@ public class InternalAprOutputBuffer ext
         if (lastActiveFilter != -1)
             activeFilters[lastActiveFilter].end();
 
-        flushBuffer();
+        flushBuffer(true);
 
         finished = true;
 
@@ -198,14 +198,18 @@ public class InternalAprOutputBuffer ext
     /**
      * Callback to write data from the buffer.
      */
-    private void flushBuffer()
-        throws IOException {
+    @Override
+    protected boolean flushBuffer(boolean block) throws IOException {
+        // TODO: Non-blocking IO not yet implemented so always block parameter
+        //       ignored
         if (bbuf.position() > 0) {
             if (Socket.sendbb(socket, 0, bbuf.position()) < 0) {
                 throw new IOException();
             }
             bbuf.clear();
         }
+        // TODO: Non-blocking IO not yet implemented so always returns false
+        return false;
     }
 
 
@@ -225,7 +229,7 @@ public class InternalAprOutputBuffer ext
 
 
     @Override
-    protected boolean flushBuffer(boolean block) throws IOException {
+    public boolean isBlocking() {
         // TODO
         return false;
     }
@@ -253,7 +257,7 @@ public class InternalAprOutputBuffer ext
             while (len > 0) {
                 int thisTime = len;
                 if (bbuf.position() == bbuf.capacity()) {
-                    flushBuffer();
+                    flushBuffer(isBlocking());
                 }
                 if (thisTime > bbuf.capacity() - bbuf.position()) {
                     thisTime = bbuf.capacity() - bbuf.position();

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=1478063&r1=1478062&r2=1478063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Wed May  1 15:57:40
2013
@@ -394,6 +394,7 @@ public class InternalNioOutputBuffer ext
         this.bufferedWriteSize = bufferedWriteSize;
     }
 
+    @Override
     public boolean isBlocking() {
         return bufferedWrite == null;
     }

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java?rev=1478063&r1=1478062&r2=1478063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java Wed May  1 15:57:40
2013
@@ -152,12 +152,9 @@ public class InternalOutputBuffer extend
      * @throws IOException an underlying I/O error occurred
      */
     @Override
-    public void endRequest()
-        throws IOException {
+    public void endRequest() throws IOException {
         super.endRequest();
-        if (useSocketBuffer) {
-            socketBuffer.flushBuffer();
-        }
+        flushBuffer(true);
     }
 
 
@@ -233,12 +230,24 @@ public class InternalOutputBuffer extend
 
 
     @Override
-    protected boolean flushBuffer(boolean block) throws IOException {
+    public boolean isBlocking() {
         // TODO
         return false;
     }
 
 
+    @Override
+    protected boolean flushBuffer(boolean block) throws IOException {
+        // Blocking connector so ignore block parameter as this will always use
+        // blocking IO.
+        if (useSocketBuffer) {
+            socketBuffer.flushBuffer();
+        }
+        // Always blocks so never any data left over.
+        return false;
+    }
+
+
     // ----------------------------------- OutputStreamOutputBuffer Inner Class
 
     /**



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


Mime
View raw message