Author: markt Date: Mon Aug 20 19:53:18 2018 New Revision: 1838473 URL: http://svn.apache.org/viewvc?rev=1838473&view=rev Log: Fix refactoring of writing from the non-blocking write buffer to the network for NIO2.
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.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=1838473&r1=1838472&r2=1838473&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Mon Aug 20 19:53:18 2018 @@ -1183,6 +1183,19 @@ public class Nio2Endpoint extends Abstra */ @Override protected void writeNonBlocking(ByteBuffer from) throws IOException { + writeNonBlockingInternal(from); + } + + + /** + * {@inheritDoc} + * <p> + * Overridden for NIO2 to enable a gathering write to be used to write + * all of the remaining data in a single additional write should a + * non-blocking write leave data in the buffer. + */ + @Override + protected void writeNonBlockingInternal(ByteBuffer from) throws IOException { // Note: Possible alternate behavior: // If there's non blocking abuse (like a test writing 1MB in a single // "non blocking" write), then block until the previous write is 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=1838473&r1=1838472&r2=1838473&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Mon Aug 20 19:53:18 2018 @@ -621,12 +621,11 @@ public abstract class SocketWrapperBase< } - /* + /** * Separate method so it can be re-used by the socket write buffer to write * data to the network */ - void writeNonBlockingInternal(ByteBuffer from) throws IOException { - // TODO Explore refactoring this method back into writeNonBlocking + protected void writeNonBlockingInternal(ByteBuffer from) throws IOException { if (socketBufferHandler.isWriteBufferEmpty()) { writeNonBlockingDirect(from); } else { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org