public static HRegion newHRegion(Path tableDir, WAL wal, FileSystem fs, Configuration conf,
    RegionInfo regionInfo, final TableDescriptor htd, RegionServerServices rsServices) {
    try {
      @SuppressWarnings("unchecked")
      Class<? extends HRegion> regionClass =
        (Class<? extends HRegion>) conf.getClass(HConstants.REGION_IMPL, HRegion.class);

      Constructor<? extends HRegion> c =
        regionClass.getConstructor(Path.class, WAL.class, FileSystem.class, Configuration.class,
          RegionInfo.class, TableDescriptor.class, RegionServerServices.class);

      return c.newInstance(tableDir, wal, fs, conf, regionInfo, htd, rsServices);
    } catch (Throwable e) {
      // todo: what should I throw here?
      throw new IllegalStateException("Could not instantiate a region instance.", e);
    }
  }
A utility method to create new instances of HRegion based on the {@link HConstants#REGION_IMPL}
configuration property.
@param tableDir   qualified path of directory where region should be located, usually the table
                  directory.
@param wal        The WAL is the outbound log for any updates to the HRegion The wal file is a
                  logfile from the previous execution that's custom-computed for this HRegion.
                  The HRegionServer computes and sorts the appropriate wal info for this
                  HRegion. If there is a previous file (implying that the HRegion has been
                  written-to before), then read it from the supplied path.
@param fs         is the filesystem.
@param conf       is global configuration settings.
@param regionInfo - RegionInfo that describes the region is new), then read them from the
                  supplied path.
@param htd        the table descriptor
@return the new instance
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java