
NIO
木易九日111
这个作者很懒,什么都没留下…
展开
-
Selector的wakeup()
/** * Causes the first selection operation that has not yet returned to return * immediately. * * <p> If another thread is currently blocked in an invocation of the * {@link #select()} or {...原创 2019-08-26 16:52:49 · 3168 阅读 · 0 评论 -
java NIO的空轮询bug 以及Netty的解决办法
这个bug是指 java的NIO在linux下selector.select()时,本来如果轮询的结果为空并且不调用wakeup的方法的话,这个selector.select()应该是一直阻塞的,但是java却会打破阻塞,继续执行,导致程序无限空转,造成CPU使用率100%这个bug只出现在linux系统下,因为linux下NIO底层使用的是epoll来实现的,而java的epoll实现存在...原创 2019-08-29 15:20:27 · 1732 阅读 · 0 评论