-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[UNDERTOW-2638] Proposal for a multi-buffer ChunkedStreamSinkConduit.write implementation #1364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UNDERTOW-2638] Proposal for a multi-buffer ChunkedStreamSinkConduit.write implementation #1364
Conversation
0106b60 to
de9101d
Compare
| // Fall back to one buffer at a time if the total srcs remaining exceeds integer max-value | ||
| // This should be very rare. | ||
| for (int i = offset; i < offset + length; i++) { | ||
| ByteBuffer buf = srcs[i]; | ||
| if (buf.hasRemaining()) { | ||
| return write(buf); | ||
| } | ||
| } | ||
| return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, we could internally reduce length and potentially dial back the limit on the final buffer, matching the chunkleft>0 case on 170
| } | ||
|
|
||
| @Override | ||
| public long write(final ByteBuffer[] srcs, final int offset, final int length) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the cost of some single-element array allocations, we could delegate the single-buffer implementation to this one, just like sslconduit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
7a85388 to
4a440d1
Compare
4a440d1 to
4cf5e23
Compare
4cf5e23 to
dae2a96
Compare
| } | ||
|
|
||
| @Override | ||
| public long write(final ByteBuffer[] srcs, final int offset, final int length) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Jira: https://issues.redhat.com/browse/UNDERTOW-2638