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.
Asked
Active
Viewed 1,304 times
2

jackson
- 23
- 5
1 Answers
2
Create a new instance in your ChannelInitializer.

Norman Maurer
- 23,104
- 2
- 33
- 31
-
But why it is not @Sharable? – Konstantin May 22 '17 at 19:03
-
1because it contains some state in the instance – Norman Maurer May 25 '17 at 16:42