private void closeScanner(HRegion region, RegionScanner scanner, String scannerName,
    RpcCallContext context, boolean isError) throws IOException {
    if (region.getCoprocessorHost() != null) {
      if (region.getCoprocessorHost().preScannerClose(scanner)) {
        // bypass the actual close.
        return;
      }
    }
    RegionScannerHolder rsh = scanners.remove(scannerName);
    if (rsh != null) {
      if (context != null) {
        context.setCallBack(rsh.closeCallBack);
      } else {
        rsh.s.close();
      }
      if (region.getCoprocessorHost() != null) {
        region.getCoprocessorHost().postScannerClose(scanner);
      }
      if (!isError) {
        closedScanners.put(scannerName, rsh.getNextCallSeq());
      }
    }
  }
Scan data in a table.
@param controller the RPC controller
@param request    the scan request
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java