Arthur Xu
Arthur Xu

Reputation: 449

why the ChannelHandler passed to io.netty.handler.codec.http2.Http2MultiplexCodecBuilder#forServer needed to be @Sharable?

Why not bind the ChannelHandler to specific EventLoop so that I don't need to care about thread safe problem thus improve performance?

Upvotes: 0

Views: 42

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23567

Because it is re-used for different streams which may use different EventLoops. If your handler is not you can just use a ChannelInitializer that will add your ChannelHandler.

Upvotes: 1

Related Questions