in core/src/main/java/org/apache/mina/transport/nio/NioSelectorLoop.java [112:142]
public void register(boolean accept, boolean connect, boolean read, boolean write, SelectorListener listener,
SelectableChannel channel, RegistrationCallback callback) {
if (IS_DEBUG) {
LOG.debug("registering : {} for accept : {}, connect: {}, read : {}, write : {}, channel : {}",
new Object[] { listener, accept, connect, read, write, channel });
}
int ops = 0;
if (accept) {
ops |= SelectionKey.OP_ACCEPT;
}
if (connect) {
ops |= SelectionKey.OP_CONNECT;
}
if (read) {
ops |= SelectionKey.OP_READ;
}
if (write) {
ops |= SelectionKey.OP_WRITE;
}
// TODO : if it's the same selector/worker, we don't need to do that we could directly enqueue
registrationQueue.add(new Registration(ops, channel, listener, callback));
// Now, wakeup the selector in order to let it update the selectionKey status
wakeup();
}