This repository was archived by the owner on Jan 14, 2026. It is now read-only.
Force flush of nio buffer when threshold is reached#84
Open
eperott wants to merge 1 commit intoinstaclustr:masterfrom
Open
Force flush of nio buffer when threshold is reached#84eperott wants to merge 1 commit intoinstaclustr:masterfrom
eperott wants to merge 1 commit intoinstaclustr:masterfrom
Conversation
Update unit tests to verify the FormattedByteChannel with the Netty ChunkedNioStream. Closes instaclustr#83
eperott
commented
Mar 31, 2020
|
|
||
| // Forcing the calling ChunkedNioStream to flush the buffer | ||
| if (hasBufferReachedChunkThreshold(dst)) { | ||
| return -1; |
Author
There was a problem hiding this comment.
The strategy used here is somewhat questionable.
Returning -1 while there's still data to read isn't exactly suggested by the ReadableByteChannel API. On the other hand, the ChunkedNioStream class, which is consuming this byte channel in Netty, seem to expect this behavior deliberately. I've verified this to work on both Netty 4.0 and 4.1.
This was the most elegant solution I could come up with that will avoid another staging buffer, and at the same time stay compatible with both Netty 4.0 and 4.1.
3b88272 to
84cb7cd
Compare
This was referenced Oct 28, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update unit tests to verify the FormattedByteChannel with the Netty ChunkedNioStream.
Closes #83