问题
Am working on UDP server which have multiple handlers.
Look at my code how I bootstrap the channel.
return new Bootstrap().
group(rtpNioEventLoopGroup()).
channel(NioDatagramChannel.class).
handler(saveToRepoHandler()).
handler(informPartyHandler());
Now my save-repo and inform-party need to be executed asynchronously. They have no dependency to each other.
Does netty execute them asynchronously ?
回答1:
Calling handler(...) multiple times will just replace the previous set handler. You want to use a ChannelInitializer and add the ChannelHandlers there. Check our examples or the javadocs for details.
来源:https://stackoverflow.com/questions/29406262/netty-udp-handlers-asynchronous