2011-10-27 18 views

回答

4

是的。 java.nio.channels.Selector.open()根據底層操作系統返回不同的實現。例如。如果您使用sun/oracle的JRE,您會得到:

Windows 
sun.nio.ch.WindowsSelectorImpl 

Mac OS 
sun.nio.ch.KQueueSelectorImpl 

Linux 
sun.nio.ch.EPollSelectorImpl 

Solaris 
sun.nio.ch.PollSelectorImpl 
+1

很酷,謝謝! –

+0

Java7更新:這就是說:與原生IOCP相比,Windows部分相當慢。窗口選擇器不能選擇超過1024個通道,因此速度非常慢......如果可能,請在窗口下使用AIO – Kr0e