I implement ChannelInboundHandlerAdapter
and ask a question about concurrency. Do I need to make threads safe? I mean, I have to store a certain state for each client for my sessions.
public class Impl extends ChannelInboundHandlerAdapter{
private List<Integer> someState;
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
int size = someState.size();
}
}
The fact is that if you request a method from a request by channelRead
different threads, I will have to put some memory barriers.
It's necessary? Or will Netty
he take care of this?
source
share