public Map<byte[], List<HStoreFile>> close(boolean abort, boolean ignoreStatus,
    boolean isGracefulStop) throws IOException {
    // Only allow one thread to close at a time. Serialize them so dual
    // threads attempting to close will run up against each other.
    MonitoredTask status =
      TaskMonitor.get().createStatus("Closing region " + this.getRegionInfo().getEncodedName()
        + (abort ? " due to abort" : " as it is being closed"), ignoreStatus, true);
    status.setStatus("Waiting for close lock");
    try {
      synchronized (closeLock) {
        if (isGracefulStop && rsServices != null) {
          rsServices.getBlockCache().ifPresent(blockCache -> {
            if (blockCache instanceof CombinedBlockCache) {
              BlockCache l2 = ((CombinedBlockCache) blockCache).getSecondLevelCache();
              if (l2 instanceof BucketCache) {
                if (((BucketCache) l2).isCachePersistenceEnabled()) {
                  LOG.info(
                    "Closing region {} during a graceful stop, and cache persistence is on, "
                      + "so setting evict on close to false. ",
                    this.getRegionInfo().getRegionNameAsString());
                  this.getStores().forEach(s -> s.getCacheConfig().setEvictOnClose(false));
                }
              }
            }
          });
        }
        return doClose(abort, status);
      }
    } finally {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Region close journal for {}:\n{}", this.getRegionInfo().getEncodedName(),
          status.prettyPrintJournal());
      }
      status.cleanup();
    }
  }
Close down this HRegion. Flush the cache unless abort parameter is true, Shut down each HStore,
don't service any more calls. This method could take some time to execute, so don't call it
from a time-sensitive thread.
@param abort          true if server is aborting (only during testing)
@param ignoreStatus   true if ignore the status (wont be showed on task list)
@param isGracefulStop true if region is being closed during graceful stop and the blocks in the
                      BucketCache should not be evicted.
@return Vector of all the storage files that the HRegion's component HStores make use of. It's
        a list of StoreFile objects. Can be null if we are not to close at this time or we are
        already closed.
@throws IOException              e
@throws DroppedSnapshotException Thrown when replay of wal is required because a Snapshot was
                                 not properly persisted. The region is put in closing mode, and
                                 the caller MUST abort after this.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java