LocalChannel: Remove dependency on SingleThreadEventExecutor#16393
Merged
Conversation
Motivation: LocalChannel had a hard dependency on SingleThreadEventExecutor which is not needed if an IoEventLoop is used. Modifications: Remove hard dependency Result: LocalChannels can be used with all IoEventLoop implementations
normanmaurer
commented
Mar 2, 2026
| } | ||
| ((SingleThreadEventExecutor) eventLoop()).addShutdownHook(shutdownHook); | ||
| EventLoop loop = eventLoop(); | ||
| if (!(loop instanceof IoEventLoop) && loop instanceof SingleThreadEventExecutor) { |
Member
Author
There was a problem hiding this comment.
IoEventLoop will close the channel already once shutdown so the hook is not needed.
Contributor
There was a problem hiding this comment.
Why not just
if (loop instanceof SingleThreadEventExecutor) {
Member
Author
There was a problem hiding this comment.
Because our IoEventLoop implementations are sub-types of it and don't need it
Contributor
There was a problem hiding this comment.
Then seems we can just override the addshutdownhook with a noop
Member
Author
There was a problem hiding this comment.
No ... people still might want to add hooks . It's just not needed for this channel itself
normanmaurer
commented
Mar 2, 2026
| protected boolean isCompatible(EventLoop loop) { | ||
| return loop instanceof SingleThreadEventLoop || | ||
| (loop instanceof IoEventLoopGroup && ((IoEventLoopGroup) loop).isCompatible(LocalServerUnsafe.class)); | ||
| (loop instanceof IoEventLoop && ((IoEventLoop) loop).isCompatible(LocalServerUnsafe.class)); |
Member
Author
There was a problem hiding this comment.
IoEventLoop is more correct here.
chrisvest
approved these changes
Mar 3, 2026
Contributor
|
Could not create auto-port PR. |
normanmaurer
added a commit
that referenced
this pull request
Mar 3, 2026
Motivation: LocalChannel had a hard dependency on SingleThreadEventExecutor which is not needed if an IoEventLoop is used. Modifications: Remove hard dependency Result: LocalChannels can be used with all IoEventLoop implementations
chrisvest
pushed a commit
that referenced
this pull request
Mar 3, 2026
…#16405) Motivation: LocalChannel had a hard dependency on SingleThreadEventExecutor which is not needed if an IoEventLoop is used. Modifications: Remove hard dependency Result: LocalChannels can be used with all IoEventLoop implementations
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.
Motivation:
LocalChannel had a hard dependency on SingleThreadEventExecutor which is not needed if an IoEventLoop is used.
Modifications:
Remove hard dependency
Result:
LocalChannels can be used with all IoEventLoop implementations