void doRead(SelectionKey key) throws InterruptedException {
      int count;
      SimpleServerRpcConnection c = (SimpleServerRpcConnection) key.attachment();
      if (c == null) {
        return;
      }
      c.setLastContact(EnvironmentEdgeManager.currentTime());
      try {
        count = c.readAndProcess();
      } catch (InterruptedException ieo) {
        LOG.info(Thread.currentThread().getName() + ": readAndProcess caught InterruptedException",
          ieo);
        throw ieo;
      } catch (Exception e) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Caught exception while reading:", e);
        }
        count = -1; // so that the (count < 0) block is executed
      }
      if (count < 0) {
        closeConnection(c);
        c = null;
      } else {
        c.setLastContact(EnvironmentEdgeManager.currentTime());
      }
    }
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