void doAccept(SelectionKey key) throws InterruptedException, IOException, OutOfMemoryError {
      ServerSocketChannel server = (ServerSocketChannel) key.channel();
      SocketChannel channel;
      while ((channel = server.accept()) != null) {
        channel.configureBlocking(false);
        channel.socket().setTcpNoDelay(tcpNoDelay);
        channel.socket().setKeepAlive(tcpKeepAlive);
        Reader reader = getReader();
        SimpleServerRpcConnection c = connectionManager.register(channel);
        // If the connectionManager can't take it, close the connection.
        if (c == null) {
          if (channel.isOpen()) {
            IOUtils.cleanupWithLogger(LOG, channel);
          }
          continue;
        }
        key.attach(c); // so closeCurrentConnection can get the object
        reader.addConnection(c);
      }
    }
Updating the readSelector while it's being used is not thread-safe, so the connection must
be queued. The reader will drain the queue and update its readSelector before performing
the next select
hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java