Rename Channel.bytesBeforeUnwritable() to writableBytes() #12530
Rename Channel.bytesBeforeUnwritable() to writableBytes() #12530normanmaurer merged 4 commits intomainfrom
Conversation
|
This depends on #12517 |
chrisvest
left a comment
There was a problem hiding this comment.
Spotted a copy-paste boo in the javadoc. Otherwise looks good.
475029b to
bdc6910
Compare
93678a0 to
317af62
Compare
|
nit: typo in summary (bytesBeforeUnwritabled) |
Good catch! |
trustin
left a comment
There was a problem hiding this comment.
Could Channel.isWritable() be left as a shortcut for writableBytes() > 0? What's the reasoning behind removing it?
|
@trustin it feels redundant... that said if you are strong about it we could also make it a default method :) WDYT ? |
2e23aaa to
e3f118c
Compare
317af62 to
180ba49
Compare
e3f118c to
0097732
Compare
534f6a0 to
ec14bcb
Compare
|
@normanmaurer Yup, let's make it a default method. Thanks a lot 🙇 |
0872695 to
0bfd198
Compare
baddf66 to
b8907a3
Compare
0bfd198 to
9604222
Compare
9604222 to
cd3d264
Compare
trustin
left a comment
There was a problem hiding this comment.
Now that we added back isWritable(), we should revert most of the writableBytes() > 0 checks in this PR, because isWritable() has much lower cognitive load on the reader. I added them as suggestions, so you can easily revert them, although you'll have to optimize imports and make Checkstyle happy.
449b664 to
7e15f47
Compare
7e15f47 to
b4fb2f9
Compare
…ritable() default method Motivation: We should expose `Channel.writableBytes()` as a replacement for both, `Channel.bytesBeforeUnwritable()` and `Channel.isWritable()`. If the `Channel` is writable this method will return a positive number which can also give the user some idea how much data they can write without the risk of having the `Channel` become unwritable, if not writable it will return 0. Modifications: - Rename Channel.bytesBeforeUnwritabled() to writableBytes() and isWritable() default method - Adjust code Result: Less reduntant API and cleanup Co-authored-by: Chris Vest <christianvest_hansen@apple.com> Co-authored-by: Trustin Lee <t@motd.kr>
b4fb2f9 to
6f5c5b6
Compare
|
Will merge this once green... |
…ritable() is removed netty/netty#12530
…ritable() is removed (#2351) - netty/netty#12530 - Temporary build on CI with PR in sock-proxy netty-contrib/socks-proxy#10
… isWritable()
Motivation:
We should expose
Channel.writableBytes()as a replacement for both,Channel.bytesBeforeUnwritable()andChannel.isWritable(). If theChannelis writable this method will return a positive number which can also give the user some idea how much data they can write without the risk of having theChannelbecome unwritable, if not writable it will return 0.Modifications:
Channel.bytesBeforeUnwritable()towritableBytes()and removeisWritable()Result:
Less reduntant API and cleanup