Netty ByteToMessageDecoder can't be @sharable

China☆狼群 提交于 2019-12-08 00:08:27

问题


I use MyDecoder which extends ByteToMessageDecoder to get Message from the socket Stream. It works fine in one thread. But in more threads, the netty has reported 'the handler should be sharable' However, I search in netty api, the ByteToMessageDecoder can't be @sharable, so how can I use it in multi thread.


回答1:


Create a new instance in your ChannelInitializer.



来源:https://stackoverflow.com/questions/26559829/netty-bytetomessagedecoder-cant-be-sharable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!