private void doRunLoop() {
    long lastPurgeTime = 0; // last check for old calls.
    while (this.simpleRpcServer.running) {
      try {
        registerWrites();
        int keyCt = writeSelector.select(this.simpleRpcServer.purgeTimeout);
        if (keyCt == 0) {
          continue;
        }

        Set<SelectionKey> keys = writeSelector.selectedKeys();
        Iterator<SelectionKey> iter = keys.iterator();
        while (iter.hasNext()) {
          SelectionKey key = iter.next();
          iter.remove();
          try {
            if (key.isValid() && key.isWritable()) {
              doAsyncWrite(key);
            }
          } catch (IOException e) {
            SimpleRpcServer.LOG.debug(getName() + ": asyncWrite", e);
          }
        }

        lastPurgeTime = purge(lastPurgeTime);

      } catch (OutOfMemoryError e) {
        if (this.simpleRpcServer.errorHandler != null) {
          if (this.simpleRpcServer.errorHandler.checkOOME(e)) {
            SimpleRpcServer.LOG.info(getName() + ": exiting on OutOfMemoryError");
            return;
          }
        } else {
          //
          // we can run out of memory if we have too many threads
          // log the event and sleep for a minute and give
          // some thread(s) a chance to finish
          //
          SimpleRpcServer.LOG.warn(getName() + ": OutOfMemoryError in server select", e);
          try {
            Thread.sleep(60000);
          } catch (InterruptedException ex) {
            SimpleRpcServer.LOG.debug("Interrupted while sleeping");
            return;
          }
        }
      } catch (Exception e) {
        SimpleRpcServer.LOG
          .warn(getName() + ": exception in Responder " + StringUtils.stringifyException(e), e);
      }
    }
    SimpleRpcServer.LOG.info(getName() + ": stopped");
  }
Add a connection to the list that want to write,
hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServerResponder.java