Netty UDP Handlers - Asynchronous?

允我心安 提交于 2019-12-12 04:56:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!