If your handler is sharable (you're not creating a new one for every input), then multiple threads may all be inside a single handler at once. In that case, you want to write handlers to be stateless - no internal variables that one input can update. Channel.attr() can be useful if you want to pass some data between handlers. Or you can chain up a bunch of MessageToMessageDecoders so each one generates the object that is the input to the next - in that case, you don't worry about whether the handlers are all called on the same thread (which is most likely given the way the thread pools Netty uses work) or not.
So, basically, Netty's handler pipeline *is* your channel for communication between handlers - use it, rather than inventing your own additional one. -Tim On Thursday, February 2, 2017 at 5:22:36 PM UTC-5, L_DisplayName wrote: > > Greetings All, > > Do the instances of channel handlers such as (SimpleChannelInboundHandler, > ChannelInboundHandlerAdapter, etc.) share the same thread and stack or do > each have it’s own thread and stack? I ask because I instantiate numerous > channel handlers and I need them to communicate with each other and I must > decide between using thread communication or non- threaded communication. > > > Thank you for your answer > -- You received this message because you are subscribed to the Google Groups "Netty discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/netty/05b64b05-9f34-497f-aa9e-4a2a9c29baed%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
