in core/src/main/java/org/apache/mina/transport/nio/NioSelectorLoop.java [157:191]
public void modifyRegistration(boolean accept, boolean read, boolean write, final SelectorListener listener,
SelectableChannel channel, boolean wakeup) {
if (IS_DEBUG) {
LOG.debug("modifying registration : {} for accept : {}, read : {}, write : {}, channel : {}", new Object[] {
listener, accept, read, write, channel });
}
final SelectionKey key = channel.keyFor(selector);
if (key == null) {
LOG.error("Trying to modify the registration of a not registered channel");
return;
}
int ops = 0;
if (accept) {
ops |= SelectionKey.OP_ACCEPT;
}
if (read) {
ops |= SelectionKey.OP_READ;
}
if (write) {
ops |= SelectionKey.OP_WRITE;
}
key.interestOps(ops);
// we need to wakeup for the registration to be modified (TODO : not needed if we are in the worker thread)
if (wakeup) {
wakeup();
}
}