@Override
  public void process() throws IOException {
    String name = regionInfo.getEncodedName();
    LOG.trace("Processing close of {}", name);
    // Check that this region is being served here
    HRegion region = (HRegion) rsServices.getRegion(name);
    try {
      if (region == null) {
        LOG.warn("Received CLOSE for region {} but currently not serving - ignoring", name);
        // TODO: do better than a simple warning
        return;
      }

      // Close the region
      if (region.close(abort, false, true) == null) {
        // This region has already been closed. Should not happen (A unit test makes this
        // happen as a side effect, TestRegionObserverInterface.testPreWALAppendNotCalledOnMetaEdit)
        LOG.warn("Can't close {}; already closed", name);
        return;
      }

      this.rsServices.removeRegion(region, destination);
      rsServices.reportRegionStateTransition(new RegionStateTransitionContext(TransitionCode.CLOSED,
        HConstants.NO_SEQNUM, Procedure.NO_PROC_ID, -1, regionInfo, -1));

      // Done! Region is closed on this RS
      LOG.debug("Closed {}", region.getRegionInfo().getRegionNameAsString());
    } finally {
      // Clear any reference in getServer().getRegionsInTransitionInRS() on success or failure,
      // since a reference was added before this CRH was invoked. If we don't clear it, it can
      // hold up regionserver abort on cluster shutdown. HBASE-23984.
      this.rsServices.getRegionsInTransitionInRS().remove(regionInfo.getEncodedNameAsBytes());
    }
  }
This method used internally by the RegionServer to close out regions.
@param abort If the regionserver is aborting.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java