netty 服务端 启动阻塞主线程

Netty的同步方式阻塞主线程

当我们在该函数中直接调用下面的代码时:

channelFuture.channel().closeFuture().sync();

Netty会进入无限循环之中,将会不再加载和扫描之后的类了。有可能你还需要mybatis、redis等,可能就扫描不到

我的处理方式是继承Runnable,然后启动新的进程跑netty的server端

new Thread(delimiterBaseServer).start();

相关资料:

https://blog.csdn.net/qq_38132901/article/details/102819557?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param

https://www.cnblogs.com/zhxiansheng/p/10789114.html

https://blog.csdn.net/weixin_34205076/article/details/92436309

原文地址:https://www.cnblogs.com/LcxSummer/p/13925132.html