title: SelectionKey with empty interest set
body: <p>I created an abstraction </p>
  
  <p><code>public interface Channel&lt;R extends SelectableChannel &amp; ReadableByteChannel, W extends SelectableChannel &amp; WritableByteChannel&gt;</code> </p>
  
  <p>for <code>java.nio.channels.SelectableChannel</code>, it provides an <code>isBidirectional</code> method and getters to retrieve the write/read channel (which may or may not be equal). This channel and possibly multiple other instances of it are used with a dispatcher for i/o that encapsulates a selector.</p>
  
  <p>Since I want to have non-blocking write, the dispatcher populates mutliple queues with ByteBuffers that should be written to the corresponding channels and adds <code>java.nio.channels.SelectionKey.OP_WRITE</code> to the key's interest set, if a write is due.</p>
  
  <p>For bidirectional channels it's a simple update operation, since the read channel (== write channel),
  is already processed with interest <code>OP_READ</code>. 
  If the channel is unidirectional, I have to get the write channel (!= read channel) and register it with interest <code>OP_WRITE</code>.</p>
  
  <hr>
  
  <p><strong>QUESTION</strong></p>
  
  <p>What should I do after I have performed my write operation assuming the queue is empty now?
  For bidirectional channels, I simply have to reset the interest set to <code>OP_READ</code>.</p>
  
  <p>But how should I handle unidirectional channels, is it okay to invoke <code>key.interestOps(0);</code>, it does not violate the method's invariant </p>
  
  <p><code>(ops &amp; ~channel().validOps()) != 0</code>.</p>
  
  <p>The interest set of the (unidirectional) write channel would then be empty.</p>
  
  <hr>
  
  <p><strong>IN SHORT</strong></p>
  
  <p>Is <code>java.nio.channels.SelectionKey.interestOps(0)</code> a correct invocation, if I'm currently not interested in the selection key? Or should I remove the key?</p>