private void doAsyncWrite(SelectionKey key) throws IOException {
    SimpleServerRpcConnection connection = (SimpleServerRpcConnection) key.attachment();
    if (connection == null) {
      throw new IOException("doAsyncWrite: no connection");
    }
    if (key.channel() != connection.channel) {
      throw new IOException("doAsyncWrite: bad channel");
    }

    if (processAllResponses(connection)) {
      try {
        // We wrote everything, so we don't need to be told when the socket is ready for
        // write anymore.
        key.interestOps(0);
      } catch (CancelledKeyException e) {
        /*
         * The Listener/reader might have closed the socket. We don't explicitly cancel the key, so
         * not sure if this will ever fire. This warning could be removed.
         */
        SimpleRpcServer.LOG.warn("Exception while changing ops : " + e);
      }
    }
  }
If there were some calls that have not been sent out for a long time, we close the connection.
@return the time of the purge.
hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServerResponder.java