如何共享 ByteToMessageDecoder?

How can I share a ByteToMessageDecoder?

我有一个扩展 ByteToMessageDecoder that's also marked as shareable via the ChannelHandler.Sharable annotation. However I encounter a runtime error with the following stack trace which is because the constructor of ByteToMessageDecoder invokes ensureNotSharable() 的解码器 class。为什么会这样,是否可以创建共享解码器?

来自 ByteToMessageDecoder 的文档:

Be aware that sub-classes of ByteToMessageDecoder MUST NOT annotated with @Sharable.

无法共享解码器。要解决此问题,请实例化一个新的解码器。