tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1478539 - in /tomcat/trunk/java/org/apache/coyote/http11: AbstractOutputBuffer.java InternalAprOutputBuffer.java InternalNioOutputBuffer.java InternalOutputBuffer.java
Date Thu, 02 May 2013 20:58:25 GMT
Author: markt
Date: Thu May  2 20:58:25 2013
New Revision: 1478539

URL: http://svn.apache.org/r1478539
Log:
Pull up hasDataToWrite()

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=1478539&r1=1478538&r2=1478539&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java Thu May  2 20:58:25
2013
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.Iterator;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -603,7 +604,8 @@ public abstract class AbstractOutputBuff
 
     //------------------------------------------------------ Non-blocking writes
 
-    protected abstract boolean hasDataToWrite();
+    protected abstract boolean hasMoreDataToFlush();
+
 
     /**
      * Writes any remaining buffered data.
@@ -640,6 +642,23 @@ public abstract class AbstractOutputBuff
     }
 
 
+    public final boolean hasDataToWrite() {
+        return hasMoreDataToFlush() || hasBufferedData();
+    }
+
+
+    private boolean hasBufferedData() {
+        boolean result = false;
+        if (bufferedWrites!=null) {
+            Iterator<ByteBufferHolder> iter = bufferedWrites.iterator();
+            while (!result && iter.hasNext()) {
+                result = iter.next().hasData();
+            }
+        }
+        return result;
+    }
+
+
     protected static class ByteBufferHolder {
         private final ByteBuffer buf;
         private final AtomicBoolean flipped;

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=1478539&r1=1478538&r2=1478539&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Thu May  2 20:58:25
2013
@@ -168,7 +168,7 @@ public class InternalAprOutputBuffer ext
     //-------------------------------------------------- Non-blocking IO methods
 
     @Override
-    protected boolean hasDataToWrite() {
+    protected boolean hasMoreDataToFlush() {
         // TODO
         return false;
     }

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=1478539&r1=1478538&r2=1478539&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Thu May  2 20:58:25
2013
@@ -269,7 +269,8 @@ public class InternalNioOutputBuffer ext
         return dataLeft;
     }
 
-    private boolean hasMoreDataToFlush() {
+    @Override
+    protected boolean hasMoreDataToFlush() {
         return (flipped && socket.getBufHandler().getWriteBuffer().remaining()>0)
||
         (!flipped && socket.getBufHandler().getWriteBuffer().position() > 0);
     }
@@ -290,25 +291,6 @@ public class InternalNioOutputBuffer ext
     }
 
 
-    //-------------------------------------------------- Non-blocking IO methods
-
-    private boolean hasBufferedData() {
-        boolean result = false;
-        if (bufferedWrites!=null) {
-            Iterator<ByteBufferHolder> iter = bufferedWrites.iterator();
-            while (!result && iter.hasNext()) {
-                result = iter.next().hasData();
-            }
-        }
-        return result;
-    }
-
-    @Override
-    public boolean hasDataToWrite() {
-        return hasMoreDataToFlush() || hasBufferedData();
-    }
-
-
     // ----------------------------------- OutputStreamOutputBuffer Inner Class
 
     /**

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=1478539&r1=1478538&r2=1478539&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java Thu May  2 20:58:25
2013
@@ -185,7 +185,7 @@ public class InternalOutputBuffer extend
     //-------------------------------------------------- Non-blocking IO methods
 
     @Override
-    protected boolean hasDataToWrite() {
+    protected boolean hasMoreDataToFlush() {
         // TODO
         return false;
     }



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


Mime
View raw message