java nio channel selectors can use kqueue/kevent

David Xu davidxu at
Mon Aug 2 09:27:48 UTC 2010

I was suprised the java uses poll() on freebsd for its nio, while
others are using devpoll() or epoll(). I have spent one week to
work out a patch, and let it work with kqueue. I have tried to make
it better, but because the java nio selector are poll() centric
so something in the patch is not very perfect.

Here is the patch:

just cd into /usr/ports/jdk16, and type following commands:

make extract
make patch
cd work
patch < this_patch_file
cd ..
make install

note that the patch does not make kqueue method as default provider,
you should specify it on comand line like following:

<application class>

David Xu

More information about the freebsd-java mailing list