while (true) {

selector.select();

Iterator ite = this.selector.selectedKeys().iterator();
while (ite.hasNext()) {
SelectionKey key = (SelectionKey) ite.next();

ite.remove();

if (key.isAcceptable()) {
ServerSocketChannel server = (ServerSocketChannel) key.channel();

SocketChannel channel = server.accept();

channel.configureBlocking(false);

channel.register(this.selector, SelectionKey.OP_READ);

} else if (key.isReadable()) {

key.interestOps(key.interestOps() & (~SelectionKey.OP_READ));

pool.execute(new ThreadHandlerChannel(key));
}
}
}
}
}