Skip to content

Commit

Permalink
Fix refactoring of writing from the non-blocking write buffer to the …
Browse files Browse the repository at this point in the history
…network for NIO2.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1838473 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Aug 20, 2018
1 parent 8313a14 commit fcf5a7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 13 additions & 0 deletions java/org/apache/tomcat/util/net/Nio2Endpoint.java
Expand Up @@ -1183,6 +1183,19 @@ protected void writeNonBlocking(byte[] buf, int off, int len) throws IOException
*/
@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
Expand Down
5 changes: 2 additions & 3 deletions java/org/apache/tomcat/util/net/SocketWrapperBase.java
Expand Up @@ -621,12 +621,11 @@ protected void writeNonBlocking(ByteBuffer from)
}


/*
/**
* 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 {
Expand Down

0 comments on commit fcf5a7a

Please sign in to comment.