I'm implementing ChannelInboundHandlerAdapter and have a question about concurrency. Is it necessary to make it thread safe? I mean I have to store some state for each client per their sessions.
public class Impl extends ChannelInboundHandlerAdapter{
private List<Integer> someState;
//
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
int size = someState.size(); //Should I worry about memory consitency here?
//...
}
}
The thing is if from request to request the channelRead method is invoked by different threads I will have to put some memory barriers.
Is it necessary? Or Netty takes care of it by itself?