1

I found this article saying OpenJDK uses epoll on linux, but does anybody know if Selector implementations use kqueue, dev/poll etc over traditional polling where available?

Jonas
  • 121,568
  • 97
  • 310
  • 388
Chris Mowforth
  • 6,689
  • 2
  • 26
  • 36

1 Answers1

5

Yes it does. java.nio.channels.Selector.open() returns different implementations depending on your underlying operating system. Eg. If you are using a JRE from sun/oracle you will get:

Windows 
sun.nio.ch.WindowsSelectorImpl

Mac OS 
sun.nio.ch.KQueueSelectorImpl

Linux 
sun.nio.ch.EPollSelectorImpl

Solaris
sun.nio.ch.PollSelectorImpl
Schildmeijer
  • 20,702
  • 12
  • 62
  • 79
  • Java7 update: That being said: The windows part is pretty slow compared to native IOCP. The windows selector cannot select more than 1024 channels and thus is pretty slow... Use AIO if possible under windows – Kr0e May 21 '14 at 12:05