1. 2.59 1.检测新连接historical

    1. 打断点 有新连接过来的时候,会调用NioEventLoop中run方法的processSelectedKeys中OP ACCEPT逻辑 1.1. 启动客户端连接 我们在unsafe.read打个断点,启动服务器,并用telnet或者nc链接 2. 新连接进入 - 进入AbstractNioMe

  2. 2.60 pipeline的初始化historical

    1. pipeline在什么时候被创建 不管是客户端还是服务端channel,都会在AbstractChannel的构造函数创建,每个channel都有一个自己的pipeline - newPipeline 2. pipeline是怎样的 - DefaultChannelPipeline pipel

  3. 2.61 1.服务端的创建historical

    bind 从这行代码开始,追踪bind 最终会来到io.netty.bootstrap.AbstractBootstrap#doBind - initAndRegister channel 要知道channelFactory是哪个,我们需要回到这行代码 - io.netty.bootstrap.Ab

  4. 2.62 1.创建spring容器historical

    1. 要分析的代码 分成创建ApplicationContext和从ApplicationContext中获取Calc的bean这两个过程,我们一步步跟踪 2. 创建ApplicationContext 2.1. AnnotationConfigApplicationContext构造方法 refr

  5. 2.63 启动原理historical

    1. 启动SpringBoot 我们直接从SpringBoot启动的这行代码开始 忽略简单的嵌套调用,最终调用的代码如下: 首先会使用主配置类Application.class创建SpringApplication,然后传入启动参数args启动 2. 创建SpringApplication的过程 我

  6. 2.64 创建Executorhistorical

    1. 要分析的代码 2. 创建构造线程的工厂 - newDefaultThreadFactory() 2.1. 设置线程池以及线程名 - DefaultThreadFactory - 设置了线程池的名字:nioEventLoopGroup - 每个线程的名字则是:nioEventLoopGroup-

  7. 2.65 2.创建NioSocketChannelhistorical

    1. 要分析的代码 this是netty服务端的channel,ch是jdk nio客户端的channel,NioSocketChannel是netty客户端的channel 2. NioSocketChannel构造函数 2.1. 设置对OP READ感兴趣 - 父类AbstractNioByte

  8. 2.66 添加删除ChannelHandlerhistorical

    1. 添加handler - DefaultChannelPipeline#addLast 1.1. 判断是否重复添加 - checkMultiplicity 1.2. 创建节点并添加至链表 - newContext - DefaultChannelHandlerContext - addLast0

  9. 2.67 2.服务端初始化historical

    调用 bind - doBind - initAndRegister - channelFactory.newChannel() - init(channel) 我们重点看这个 ServerBootstrap - init

  10. 2.68 2.调用BeanFactoryPostProcessor的postProcess方法historical

    1. 要研究的代码 - AbstractApplicationContext invokeBeanFactoryPostProcessors 关键的是这一句 PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(beanF