- java-在Spring初始化过程中阻塞合理吗?
-
聚码交流
-
0
1

- yhuxAvNbtxUM
0000-00-00 00:00:00
- 回帖
读到了NettyRPC的代码,发现RpcServer中实现了Spring的InitializingBean,在方法实现里启动了一个Netty服务器,并且阻塞了.@OverridepublicvoidafterPropertiesSet()throwsException{EventLoopGroupbossGroup=newNioEventLoopGroup();EventLoopGroupworkerGroup=newNioEventLoopGroup();try{//前略...future.channel().closeFuture().sync();}finally{workerGroup.shutdownGracefully();bossGroup.shutdownGracefully();}}源码地址:https://github.com/luxiaoxun/...我想问的是这样阻塞不会对Spring的初始化造成影响吗?(没有读过Spring源码,并不清楚情况,求大家不吝赐教...