Open
Conversation
Contributor
MiKKiYang
commented
Jul 23, 2025
- 原实现存在资源泄露风险,使用try-with-resources管理InputStream/OutputStream,100%避免资源泄漏
- 空数据处理中,使用StandardCharsets.UTF_8,跨平台行为一致以避免中文等特殊字符乱码
- 调整缓冲区大小,1kb -> 8kb,减少系统调用次数提升传输效率
- 合理进行响应体设置,对正常数据和空数据均正确设置Content-Length
- 错误日志记录请求关键参数(nodeId, domainDataId)和完整堆栈
- 优化异常处理,单独捕获IOException,区分IO错误和系统错误
- 流结束判断改用!= -1严格判断EOF,参见Returns the number of bytes actually read, or -1 if the end of the stream has been reached.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.