@Override
  public synchronized void close() throws IOException {
    if (!closed) {
      closed = true;

      Exception caughtException = null;
      try {
        din.close();
      } catch (Exception err) {
        LOG.error("Error closing input stream:" + err.getMessage(), err);
        caughtException = err;
      }
      // Don't close the socket - the stream already does that if needed.

      if (client != null) {
        try {
          client.close();
        } catch (Exception err) {
          LOG.error("Error closing client:" + err.getMessage(), err);
          caughtException = (caughtException == null ? err : caughtException);
        }
      }

      if (caughtException != null) {
        throw new IOException("Exception during close: " + caughtException.getMessage(), caughtException);
      }
    }
  }
Base LLAP RecordReader to handle receiving of the data from the LLAP daemon.
llap-client/src/java/org/apache/hadoop/hive/llap/LlapBaseRecordReader.java