hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1594529 - /httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
Date Wed, 14 May 2014 09:56:52 GMT
Author: olegk
Date: Wed May 14 09:56:51 2014
New Revision: 1594529

URL: http://svn.apache.org/r1594529
Log:
Minor performance optimization tweak for pipelining mode

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java?rev=1594529&r1=1594528&r2=1594529&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
Wed May 14 09:56:51 2014
@@ -157,7 +157,16 @@ public class BaseIOReactor extends Abstr
     protected void readable(final SelectionKey key) {
         final IOSession session = getSession(key);
         try {
-            this.eventDispatch.inputReady(session);
+            // Try to gently feed more data to the event dispatcher
+            // if the session input buffer has not been fully exhausted
+            // (the choice of 5 iterations is purely arbitrary)
+            for (int i = 0; i < 5; i++) {
+                this.eventDispatch.inputReady(session);
+                if (!session.hasBufferedInput()
+                        || (session.getEventMask() & SelectionKey.OP_READ) == 0) {
+                    break;
+                }
+            }
             if (session.hasBufferedInput()) {
                 this.bufferingSessions.add(session);
             }



Mime
View raw message