for (Iterator i = selector.keys().iterator(); i.hasNext(); ) {
SelectionKey key = (SelectionKey) i.next();
SelectableChannel channel = key.channel();
synchronized(channel.blockingLock()) {
RubyIO originalIO = (RubyIO) TypeConverter.convertToType(
(IRubyObject) key.attachment(), runtime.getIO(),
MethodIndex.TO_IO, "to_io");
boolean blocking = originalIO.getBlocking();
key.cancel();
channel.configureBlocking(blocking);
}