Given a SelectableChannel c and its SelectionKey k, k.isWritable() returns, whether the channel is ready to accept calls to write().
However, can k.isWritable() return true if the channel accepts writes, but OP_WRITE isn't set in interestOps?
Given a SelectableChannel c and its SelectionKey k, k.isWritable() returns, whether the channel is ready to accept calls to write().
However, can k.isWritable() return true if the channel accepts writes, but OP_WRITE isn't set in interestOps?
No, ready ops is subset of interest ops. if key isn't interested in write, selector will not set its write ready op (which does not mean it cannot accept write. you can call write() anytime. with write-ready, write() is very likely to succeed, but there's not guarantee there either)