Skip to content

Conversation

@carterkozak
Copy link
Contributor

@carterkozak carterkozak commented Aug 18, 2022

Comment on lines 141 to 151
// 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;
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@carterkozak carterkozak marked this pull request as ready for review August 26, 2022 23:11
@fl4via fl4via self-requested a review September 18, 2022 12:06
@fl4via fl4via added the enhancement Enhances existing behaviour or code label Sep 18, 2022
@carterkozak carterkozak force-pushed the ckozak/UNDERTOW-2142-batch-chunk-proposal branch from 7a85388 to 4a440d1 Compare October 12, 2022 15:19
@fl4via fl4via changed the title Proposal for a multi-buffer ChunkedStreamSinkConduit.write implementation [UNDERTOW-2638] Proposal for a multi-buffer ChunkedStreamSinkConduit.write implementation Oct 15, 2025
@fl4via fl4via force-pushed the ckozak/UNDERTOW-2142-batch-chunk-proposal branch from 4a440d1 to 4cf5e23 Compare October 15, 2025 22:48
@fl4via fl4via force-pushed the ckozak/UNDERTOW-2142-batch-chunk-proposal branch from 4cf5e23 to dae2a96 Compare October 15, 2025 22:51
}

@Override
public long write(final ByteBuffer[] srcs, final int offset, final int length) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@fl4via fl4via added waiting CI check Ready to be merged but waiting for CI check next release This PR will be merged before next release or has already been merged (for payload double check) and removed waiting CI check Ready to be merged but waiting for CI check labels Oct 15, 2025
@fl4via fl4via merged commit 65d8b1f into undertow-io:main Oct 16, 2025
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhances existing behaviour or code next release This PR will be merged before next release or has already been merged (for payload double check)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants