Reactor 模式
kafka Reactor 模式?
netty Reactor 模式?
tomcat Reactor 模式?
jetty Reactor 模式?
https://docs.oracle.com/javase/8/docs/technotes/guides/io/enhancements.html
BIO 问题
线程消耗 1+N
NIO 问题
Is ServerSocketChannel block ?
Is (client) SocketChannel block ?
What Selector
bio 通常指 one client one thread 模式
ServerSocket ss = new ServerSocket();
SocketAddress sa = new InetSocketAddress(9886);
ss.bind(sa, 100);
while (!Thread.interrupted()) {
Socket sk = ss.accept();
// 可以使用线程池处理
new Thread(() -> {
handle(sk);
}).start();
}
https://en.wikipedia.org/wiki/Non-blocking_I/O_(Java)
https://docs.oracle.com/javase/1.5.0/docs/guide/nio/index.html