Questions about the doWrite method of NioSocketChannel
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 35.1k
- Forks
- 16.3k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 143
Description
Hello, in the doWrite method of NioSocketChannel, if writeSpinCount reaches 0 at the same time all the data has been processed, then the method will call incompleteWrite(false) at the end to submit the flush0 task. I'm not sure if this is the correct understanding. If so, I think that performing ChannelOutboundBuffer.isEmpty after the loop completes is significantly less costly than submitting the task. I hope this helps, thank you!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading NioSocketChannel's doWrite method and the ChannelOutboundBuffer.isEmpty and incompleteWrite paths mentioned in the report. Verify whether the loop can exhaust both writeSpinCount and the outbound data, then determine whether the proposed empty-buffer check preserves the existing flush0 behavior; done means the behavior is confirmed or a focused change is justified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100