GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ChannelHandler: Simplify ChannelHandler hierarchy by normanmaurer · Pull Request #15991 · netty/netty

Conversation

@normanmaurer

@normanmaurer normanmaurer commented Dec 8, 2025

Copy link
Copy Markdown
Member

Motivation:

As we are now able to use default methods we can remove all the Channel*HandlerAdapter classes. This simplfies the hierachy a lot and reduced code that we need to maintain.
Beside this we can also get rid of the @sharable annotation and just make isSharable() part of the ChannelHandler interface itself.

Modifications:

  • Add default methods to ChannelHandler to remove ChannelHandlerAdapter
  • Add default methods to ChannelInboundHandler to remove ChannelInboundHandlerAdapter
  • Add default methods to ChannelOutboundHandler to remove ChannelOutboundHandlerAdapter
  • Change ChannelDuplexHandler from a class to an interface
  • Remove redunant code and just use the default methods where possible.
  • Remove @sharable and replace it with ChannelHandler.isSharable()
  • Adjust code to use interfaces only and not the adapter classes.
  • Remove all adapter classes.

Result:

Simplify ChannelHandler hierarchy and remove duplicated code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@normanmaurer
normanmaurer requested review from bryce-anderson and chrisvest December 9, 2025 01:12
@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Dec 9, 2025
bryce-anderson
bryce-anderson approved these changes Dec 9, 2025
View reviewed changes

@bryce-anderson bryce-anderson left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was a monster. 😂

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicheQuicCodecTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Dec 9, 2025

Copy link
Copy Markdown
Member Author

That was a monster. 😂

I have more monsters on the way 🤣

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chrisvest
chrisvest reviewed Dec 9, 2025
View reviewed changes

@chrisvest chrisvest left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had some comments

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread codec-base/src/main/java/io/netty/handler/codec/DatagramPacketEncoder.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread handler/src/test/java/io/netty/handler/ssl/PkiTestingTlsTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread microbench/src/main/java/io/netty/microbench/channel/EmbeddedChannelHandlerContext.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread transport/src/main/java/io/netty/channel/DefaultChannelPipeline.java
}
h.added = true;
}
// TODO: Do we want to add some kind of support for this again ?

@chrisvest chrisvest Dec 9, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to iterate the pipeline. Or maintain an identity hash set. This is the place where we enforce sharability.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@normanmaurer normanmaurer Dec 10, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that we would do this in a "static fashion" because we want to detect if a ChannelHandler was added to different ChannelPipelines as well. I am not sure this is really worth it in terms of perf overhead. Or maybe we can do this when enabled via a property or so. WDYT ?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@chrisvest chrisvest Dec 11, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it could be added to a different pipeline. Yeah, that complicates stuff. Ok, let's skip this for now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

normanmaurer reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@normanmaurer
normanmaurer force-pushed the channelhandler_hierarchy branch from 52e6412 to 4bea43e Compare December 10, 2025 14:03
@normanmaurer

normanmaurer commented Dec 10, 2025

Copy link
Copy Markdown
Member Author

@chrisvest PTAL again

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer requested a review from chrisvest December 10, 2025 14:04
@normanmaurer
normanmaurer force-pushed the channelhandler_hierarchy branch from 4bea43e to 76a1532 Compare December 11, 2025 00:02
normanmaurer and others added 6 commits December 10, 2025 20:03
@normanmaurer
ChannelHandler: Simplify ChannelHandler hierarchy
c9072d5
Motivation:

As we are now able to use default methods we can remove all the Channel*HandlerAdapter classes. This simplfies the hierachy a lot and reduced code that we need to maintain.
Beside this we can also get rid of the @sharable annotation and just make isSharable() part of the ChannelHandler interface itself.

Modifications:

- Add default methods to ChannelHandler to remove ChannelHandlerAdapter
- Add default methods to ChannelInboundHandler to remove ChannelInboundHandlerAdapter
- Add default methods to ChannelOutboundHandler to remove ChannelOutboundHandlerAdapter
- Change ChannelDuplexHandler from a class to an interface
- Remove redunant code and just use the default methods where possible.
- Remove @sharable and replace it with ChannelHandler.isSharable()
- Adjust code to use interfaces only and not the adapter classes.
- Remove all adapter classes.

Result:

Simplify ChannelHandler hierarchy and remove duplicated code
@normanmaurer
Remove ChannelDuplexHandler
f82f532
@normanmaurer @bryce-anderson
Update codec-native-quic/src/test/java/io/netty/handler/codec/quic/Qu…
02db8ec
…icheQuicCodecTest.java

Co-authored-by: Bryce Anderson <[email protected]>
@normanmaurer
Fix metadata
7c7bfd3
@normanmaurer
Address comments
d1ba29a
@normanmaurer
Fixes after rebasee
737813b
@normanmaurer
normanmaurer force-pushed the channelhandler_hierarchy branch from 76a1532 to 737813b Compare December 11, 2025 04:03
@normanmaurer

normanmaurer commented Dec 11, 2025

Copy link
Copy Markdown
Member Author

@chrisvest any more concerns or is this ready to be pulled in ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chrisvest
chrisvest reviewed Dec 11, 2025
View reviewed changes
Comment thread codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
Address comment
c5a9012
@normanmaurer

normanmaurer commented Dec 11, 2025

Copy link
Copy Markdown
Member Author

Talked with @chrisvest this can go in now

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer merged commit 5c8d5ae into 5.0 Dec 11, 2025
@normanmaurer
normanmaurer deleted the channelhandler_hierarchy branch December 11, 2025 17:26
@normanmaurer normanmaurer mentioned this pull request Sep 22, 2026
suspend race fix #17588
Closed
@normanmaurer normanmaurer mentioned this pull request Oct 20, 2026
fix iouring zerocopy iov overwrite #17936
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chrisvest chrisvest chrisvest left review comments
@bryce-anderson bryce-anderson bryce-anderson approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

5.0.0.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@normanmaurer @chrisvest @bryce-anderson
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.