@Test public void testInterruptEventLoopThread() throws Exception { EventLoopGroup group = new NioEventLoopGroup(1); final NioEventLoop loop = (NioEventLoop) group.next(); try { Selector selector = loop.unwrappedSelector(); assertTrue(selector.isOpen()); loop.submit(new Runnable() { @Override public void run() { Thread.currentThread().interrupt(); } }).syncUninterruptibly(); assertTrue(selector.isOpen()); final CountDownLatch latch = new CountDownLatch(2); loop.submit(new Runnable() { @Override public void run() { latch.countDown(); } }).syncUninterruptibly(); loop.schedule(new Runnable() { @Override public void run() { latch.countDown(); } }, 2, TimeUnit.SECONDS).syncUninterruptibly(); latch.await(); assertSame(selector, loop.unwrappedSelector()); assertTrue(selector.isOpen()); } finally { group.shutdownGracefully(); } }
Selector unwrappedSelector() { return unwrappedSelector; }
NioEventLoop extends SingleThreadEventLoop { Selector unwrappedSelector() { return unwrappedSelector; } }
NioEventLoop extends SingleThreadEventLoop { Selector unwrappedSelector() { return unwrappedSelector; } NioEventLoop(NioEventLoopGroup parent, Executor executor, SelectorProvider selectorProvider,
                 SelectStrategy strategy, RejectedExecutionHandler rejectedExecutionHandler); }
NioEventLoop extends SingleThreadEventLoop { Selector unwrappedSelector() { return unwrappedSelector; } NioEventLoop(NioEventLoopGroup parent, Executor executor, SelectorProvider selectorProvider,
                 SelectStrategy strategy, RejectedExecutionHandler rejectedExecutionHandler); SelectorProvider selectorProvider(); @Override int pendingTasks(); void register(final SelectableChannel ch, final int interestOps, final NioTask<?> task); int getIoRatio(); void setIoRatio(int ioRatio); void rebuildSelector(); }
NioEventLoop extends SingleThreadEventLoop { Selector unwrappedSelector() { return unwrappedSelector; } NioEventLoop(NioEventLoopGroup parent, Executor executor, SelectorProvider selectorProvider,
                 SelectStrategy strategy, RejectedExecutionHandler rejectedExecutionHandler); SelectorProvider selectorProvider(); @Override int pendingTasks(); void register(final SelectableChannel ch, final int interestOps, final NioTask<?> task); int getIoRatio(); void setIoRatio(int ioRatio); void rebuildSelector();  }