Author: markt Date: Fri Jan 9 20:08:10 2015 New Revision: 1650639 URL: http://svn.apache.org/r1650639 Log: Code review looking for possible causes of performance drop in NIO2. The completion handler will clear the socketWriteBuffer so no need to do it again in flush. This restores a few % of performance.
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.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=1650639&r1=1650638&r2=1650639&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 20:08:10 2015 @@ -1109,9 +1109,7 @@ public class Nio2Endpoint extends Abstra @Override public void write(boolean block, byte[] buf, int off, int len) throws IOException { - if (len == 0) - return; - if (getSocket() == null) + if (len == 0 || getSocket() == null) return; if (block) { @@ -1246,12 +1244,8 @@ public class Nio2Endpoint extends Abstra } else { // Nothing was written writePending.release(); - } - if (writePending.availablePermits() > 0) { - if (socketWriteBuffer.remaining() == 0) { - socketWriteBuffer.clear(); - writeBufferFlipped = false; - } + socketWriteBuffer.clear(); + writeBufferFlipped = false; } } return hasDataToWrite(); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org