问题
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