Douglas C. Schmidt 1995年提出:
An Object Behavioral Pattern for Demultiplexing and
Dispatching Handles for Synchronous Events
Scalable IO in Java - Doug Lea
http://gee.cs.oswego.edu/dl/cpjslides/nio.pdf
基于Java IO对Reactor模式进行阐述
NIO 网络框架的典型模式
Mina、Netty、Cindy 都是此模式的实现
单线程
多线程 Reactor
Multiple Reactor
其他主从形式,但是不常用
EventLoopGroup eventExecutors = new NioEventLoopGroup(1);
ServerBootstrap serverBootstrap = new ServerBootstrap().group(eventExecutors,eventExecutors);
EventLoopGroup eventExecutors = new NioEventLoopGroup(1);
ServerBootstrap serverBootstrap = new ServerBootstrap().group(eventExecutors,eventExecutors);//Handler使用线程池进行处理
Multiple Reactor
EventLoopGroup eventExecutors = new NioEventLoopGroup(1);
EventLoopGroup workereventExecutors = new NioEventLoopGroup();
ServerBootstrap serverBootstrap = new ServerBootstrap().group(eventExecutors,workereventExecutors);
EventLoopGroup eventExecutors = new NioEventLoopGroup();
EventLoopGroup workereventExecutors = new NioEventLoopGroup();
ServerBootstrap serverBootstrap = new ServerBootstrap().group(eventExecutors,workereventExecutors);
EventExecutor视图
喜欢,在看