You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2015/01/28 13:11:54 UTC

svn commit: r1655272 - in /tomcat/trunk/java/org/apache: coyote/http11/Http11Nio2Protocol.java tomcat/util/net/Nio2Endpoint.java

Author: remm
Date: Wed Jan 28 12:11:54 2015
New Revision: 1655272

URL: http://svn.apache.org/r1655272
Log:
Cleanup and simplify.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java
    tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java?rev=1655272&r1=1655271&r2=1655272&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java Wed Jan 28 12:11:54 2015
@@ -161,7 +161,7 @@ public class Http11Nio2Protocol extends
                 ((Nio2Endpoint) proto.getEndpoint()).removeTimeout(socket);
             }
             if (addToPoller) {
-                ((Nio2Endpoint) proto.getEndpoint()).awaitBytes(socket);
+                ((Nio2SocketWrapper) socket).awaitBytes();
             }
         }
 
@@ -191,7 +191,7 @@ public class Http11Nio2Protocol extends
             } else if (processor.isUpgrade()) {
                 if (((Nio2SocketWrapper) socket).isUpgradeInit()) {
                     try {
-                        ((Nio2Endpoint) proto.getEndpoint()).awaitBytes(socket);
+                        ((Nio2SocketWrapper) socket).awaitBytes();
                     } catch (ReadPendingException e) {
                         // Ignore, the initial state after upgrade is
                         // impossible to predict, and a read must be pending

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=1655272&r1=1655271&r2=1655272&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Wed Jan 28 12:11:54 2015
@@ -1261,13 +1261,11 @@ public class Nio2Endpoint extends Abstra
         @Override
         public void registerReadInterest() {
             synchronized (readCompletionHandler) {
-                if (readPending.tryAcquire()) {
-                    readPending.release();
-
+                if (readPending.availablePermits() == 0) {
+                    readInterest = true;
+                } else {
                     // If no read is pending, notify
                     getEndpoint().processSocket(this, SocketStatus.OPEN_READ, true);
-                } else {
-                    readInterest = true;
                 }
             }
         }
@@ -1359,13 +1357,6 @@ public class Nio2Endpoint extends Abstra
         }
     }
 
-    public void awaitBytes(SocketWrapperBase<Nio2Channel> socket) {
-        if (socket == null) {
-            return;
-        }
-        ((Nio2SocketWrapper) socket).awaitBytes();
-    }
-
     private CompletionHandler<Integer, SendfileData> sendfile = new CompletionHandler<Integer, SendfileData>() {
 
         @Override
@@ -1388,7 +1379,7 @@ public class Nio2Endpoint extends Abstra
                     }
                     if (attachment.keepAlive) {
                         if (!isInline()) {
-                            awaitBytes(attachment.socket);
+                            attachment.socket.awaitBytes();
                         } else {
                             attachment.doneInline = true;
                         }



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