You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/01/09 14:39:52 UTC

svn commit: r1650527 - in /tomcat/trunk: java/org/apache/tomcat/util/net/Nio2Endpoint.java java/org/apache/tomcat/util/net/SocketWrapperBase.java test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java

Author: markt
Date: Fri Jan  9 13:39:51 2015
New Revision: 1650527

URL: http://svn.apache.org/r1650527
Log:
Simplify. Entries are removed from bufferedWrites as soon as they are fully written so the code only needs to check for size() > 0.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
    tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650527&r1=1650526&r2=1650527&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Fri Jan  9 13:39:51 2015
@@ -1253,7 +1253,7 @@ public class Nio2Endpoint extends Abstra
                             }
                         }
                     }
-                    return hasMoreDataToFlush() || hasBufferedData() || getError() != null;
+                    return hasDataToWrite();
                 }
             }
         }
@@ -1262,7 +1262,7 @@ public class Nio2Endpoint extends Abstra
         @Override
         public boolean hasDataToWrite() {
             synchronized (writeCompletionHandler) {
-                return hasMoreDataToFlush() || hasBufferedData() || getError() != null;
+                return hasMoreDataToFlush() || bufferedWrites.size() > 0 || getError() != null;
             }
         }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1650527&r1=1650526&r2=1650527&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Fri Jan  9 13:39:51 2015
@@ -183,17 +183,8 @@ public abstract class SocketWrapperBase<
         (!writeBufferFlipped && socketWriteBuffer.position() > 0);
     }
 
-    protected boolean hasBufferedData() {
-        boolean result = false;
-        Iterator<ByteBufferHolder> iter = bufferedWrites.iterator();
-        while (!result && iter.hasNext()) {
-            result = iter.next().hasData();
-        }
-        return result;
-    }
-
     public boolean hasDataToWrite() {
-        return hasMoreDataToFlush() || hasBufferedData();
+        return hasMoreDataToFlush() || bufferedWrites.size() > 0;
     }
 
     public boolean isReadyForWrite() {

Modified: tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java?rev=1650527&r1=1650526&r2=1650527&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java Fri Jan  9 13:39:51 2015
@@ -69,7 +69,7 @@ public class TestWebSocketFrameClient ex
 
         // Ignore the latch result as the message count test below will tell us
         // if the right number of messages arrived
-        handler.getLatch().await(TesterFirehoseServer.WAIT_TIME_MILLIS,
+        handler.getLatch().await(TesterFirehoseServer.WAIT_TIME_MILLIS / 4,
                 TimeUnit.MILLISECONDS);
 
         Queue<String> messages = handler.getMessages();



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


Re: svn commit: r1650527 - in /tomcat/trunk: java/org/apache/tomcat/util/net/Nio2Endpoint.java java/org/apache/tomcat/util/net/SocketWrapperBase.java test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java

Posted by Mark Thomas <ma...@apache.org>.
On 09/01/2015 13:46, Rémy Maucherat wrote:
> 2015-01-09 14:39 GMT+01:00 <ma...@apache.org>:
> 
>> Author: markt
>> Date: Fri Jan  9 13:39:51 2015
>> New Revision: 1650527
>>
>> URL: http://svn.apache.org/r1650527
>> Log:
>> Simplify. Entries are removed from bufferedWrites as soon as they are
>> fully written so the code only needs to check for size() > 0.
>>
> I am testing, and there seems to be an issue with the connection count not
> going down, so things end up blocking in countUpOrAwaitConnection() at some
> point. Will continue testing obviously.

The Gump errors reported appear to be related to the refactoring as
well. The tests work on OSX (where I did the development) but not Linux
or Windows. I'm working on a fix and cleaning up the isReady() / write
registration code at the same time.

Mark


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


Re: svn commit: r1650527 - in /tomcat/trunk: java/org/apache/tomcat/util/net/Nio2Endpoint.java java/org/apache/tomcat/util/net/SocketWrapperBase.java test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java

Posted by Rémy Maucherat <re...@apache.org>.
2015-01-09 14:39 GMT+01:00 <ma...@apache.org>:

> Author: markt
> Date: Fri Jan  9 13:39:51 2015
> New Revision: 1650527
>
> URL: http://svn.apache.org/r1650527
> Log:
> Simplify. Entries are removed from bufferedWrites as soon as they are
> fully written so the code only needs to check for size() > 0.
>
> I am testing, and there seems to be an issue with the connection count not
going down, so things end up blocking in countUpOrAwaitConnection() at some
point. Will continue testing obviously.

Rémy