java.nio and SelectionKey.interestOps(int i)

Kurt Miller kurt at
Tue Jan 20 19:51:09 PST 2009

Hello Martin,

Can you post a minimal test case that reproduces the issue?


Martin Kihlgren wrote:
> Hello list!
> I have this problem that I thought maybe you could help explaining.
> I have this application, where a server thread loops around a
> select(), and then does stuff to the different SelectableChannels that
> pops out from the Selector.
> If something is read from a channel, for example, I send it to a
> handler. And if the handler wants to respond in some way, it adds it
> to a queue and then does interestOps(interestOps() &
> SelectionKey.OP_WRITE) on its SelectionKey. Then it does wakeup() on
> its Selector.
> In Sun's java 6 for linux, this works beautifully. The Selector wakes
> up, does another select, and finds that suddenly this
> SelectableChannel wants to be (and can be) written to.
> In SoyLatte, however, nothing happens! No matter if I wake the
> selector up one or many times, it doesn't recognize that the
> SelectableChannel and its SelectionKey is interested in OP_WRITE.
> Any ideas?
> regards,
> //Martin Kihlgren

More information about the bsd-port-dev mailing list